I want to generate a random string that has to have 5 letters from a-z and 3 numbers.
How can I do this with JavaScript?
I\'ve got the following script, but
And finally, without using floating point hacks:
function genpasswd(n) { // 36 ** 11 > Number.MAX_SAFE_INTEGER if (n > 10) throw new Error('Too big n for this function'); var x = "0000000000" + Math.floor(Number.MAX_SAFE_INTEGER * Math.random()).toString(36); return x.slice(-n); }