Re:Math.random() in v8 is not very random
by olliej on Thursday November 19, 2015 @08:46PM
(#10599068)
True, but there's also no requirement for quality -- the webkit/javascriptcore rng is a trivially simple generator, with no real statistical analysis performed -- back in the day i ddi some rudimentary testing (simple things like the birthday and pi tests) -- the only real reason you could get away with it in this use case would be that it use a separate ring for every page, and those rngs are seeded from "true" random on every load.
The article doesn't suggest Math.random() should be cryptographically secure (although that is an option). Rather, it's a critique of the algorithm that's being used. There are better algorithms with no drawbacks that produce sequences you can safely assume have a statistically random distribution (even if the sequence is predictable and is therefore not cryptographically secure).