quote:
Originally posted by markee
Matty needs to learn how to do better randomness....
code:
return rn_txt[Math.round((rn_txt.length-1)*Math.random())];
Should be:
code:
return rn_txt[Math.floor((rn_txt.length)*Math.random())];
Otherwise the first and last variable only have half the probability of being chosen as any other (assuming Math.random is truely random).
Clearly I didn't alter that function except for removing the undeclared variable.