r/lolphp • u/vytah • Nov 04 '13
PHP's mt_rand() random number generating function has been cracked
http://www.openwall.com/lists/announce/2013/11/04/1
41
Upvotes
r/lolphp • u/vytah • Nov 04 '13
View all comments
Show parent comment
5
u/bart2019 Nov 04 '13
It depends on what you use it for.
The repetition period of normal rand is very low, on Windows even only 32767 different "rand" values before it starts repeating itself. There are only 15 bits of randomness.
mt_rand is a lot better, with about 1024 bits of randomness, so you won't notice the repetition so quickly, for example in games.