Last active
December 24, 2015 01:09
-
-
Save ArupSen/6721907 to your computer and use it in GitHub Desktop.
A simple random string generator of any length. Only lower case characters a-z.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function randomString(stringLen) { | |
var lowerChars = 'abcdefghijklmnopqrstuvwxyz'; | |
var randomString = ''; | |
for (var i=0; i < stringLen; i++) { | |
var rNum = Math.floor(Math.random() * 25); | |
randomString += lowerChars.charAt(rNum); | |
} | |
return randomString; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment