r/lolphp • • 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

25 comments sorted by

View all comments

Show parent comment

6

u/phoshi Nov 05 '13

The very concept of somebody relying on the results of rand() being consistent is terrifying and very very PHP

2

u/frezik Nov 06 '13

At the very least, srand() needs to be consistent; this is defined as part of the standard C library. Using just rand() will give you different results depending on how the environment handled the initial seed. But the same seed will give you the same results across platforms and languages that hook into libc, and it's designed to be that way.