I would like to know how I could force the system seed each time I call math.random() method on JavaScript. Thanks Roge
Asked
Active
Viewed 192 times
0
-
1You can't seed `Math.random`. – Blender May 27 '13 at 22:20
-
1JS's pseudo-random number generator `Math.random()` uses platform-dependent methods. On a browser environment, implementations usually seed from the OS's time I believe. – Fabrício Matté May 27 '13 at 22:21
-
1To add to @FabrícioMatté said: http://stackoverflow.com/questions/2344312/how-is-randomness-achieved-with-math-random-in-javascript – elclanrs May 27 '13 at 22:36
-
@Blender thanks. So, I can't seed math.random on JS. I will post another question about this in a new post. – user2426433 May 28 '13 at 09:36
1 Answers
0
I'm pretty sure the random engine for Java automatically re-seeds itself as necessary. It's a pretty well designed system. If you feel like your random numbers aren't random enough, try doing a benchmark test on 10,000 random numbers and see what kind of distribution you get.
Usually when I feel my numbers aren't random enough, it's because I'm putting too much focus on a small number of random generations that don't have the depth of variety I'm hoping for.

redux
- 1,157
- 10
- 21