tycon
Version:
Node.js console typing test. Easy, Med, & Hard Difficulties, Speed graph, Shortcuts
20 lines (13 loc) • 446 B
JavaScript
(function(){"use strict"})()
const AppConfig = require("./../app-config.js")
const TestConfig = require("./../test-config.js")
var ran = function(word) {
let difficulty = TestConfig.store.test.difficulty
let randomMax = AppConfig.test.diffOptions.length*3 + 1
let diffRandom = Math.floor((Math.random() * randomMax))
if (diffRandom < difficulty+1) {
word = word[0].toUpperCase() + word.slice(1)
}
return word
}
module.exports = ran