

Why is Google Chrome's Math.random number generator not that random? - pseudosavant
http://stackoverflow.com/questions/9550796/why-is-google-chromes-math-random-number-generator-not-that-random

======
TrainedMonkey
Relevant answer from SO:

Apparently Math.random() in V8 only works with 32 bit values (and didn't even
correctly randomize all of those in the past). And with 32 bits, the
probability of a collision reaches 50% around 2^16 = 65k values...

Here is bug report:
[https://code.google.com/p/chromium/issues/detail?id=276886](https://code.google.com/p/chromium/issues/detail?id=276886)

------
alwaysdoit
32bits of randomness seems like plenty for most applications, and if you need
more than that you should really specify that explicitly. If it speeds up
Math.Random() for 90% of uses that seems like a reasonable optimization to me.

~~~
pseudosavant
FWIW, it wasn't enough randomness for me. I was seeing collisions in some
trivial code in Chrome that worked fine in every single other browser. It's
not like Chrome's Math.random performance is significantly better than other
modern browsers.

