You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

14 lines
437 B

let validCharacters = ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
genRandomString = (stringLength) => {
let newString = ''
for (let i = 0; i < stringLength; i++) {
$index = Math.floor(Math.random() * 35)
newString += validCharacters[$index]
}
return newString
}
module.exports = {
genRandomString: genRandomString
}