In this post I’m going to share a JavaScript function, if you call it (and assign some number as length of randomized text you want), it will return random text.
Here is the function:
function genRand(length) {
var tmp = "";
var availChars = "abcd12345";
for (var i = 0; i < length; i++)
tmp += availChars.charAt(Math.floor(Math.random() * availChars.length));
return tmp;
}
And also watch this video to see the demonstration: