3 ms·
Math.random() in modern browsers is a pretty good RNG. He would probably be happier with a pseudo-random algorithm or simple rotation, but over time a uniform d
by ricardobeat 13y ago
Math.random() in modern browsers is a pretty good RNG. He would probably be happier with a pseudo-random algorithm or simple rotation, but over time a uniform distribution should be seen if his code is correct: http://coffeescript.org/#try:alert%20%5B0..300%5D.reduce%20(p%2Cc%2Ci)%20-%3E%0A%20%20%20%20%2B%2Bp%5BMath.floor(Math.random()%20*%203)%5D%3B%20p%0A%2C%20%5B0%2C0%2C0%5D http://coffeescript.org/#try:alert%20%5B0..300%5D.reduce%20(...