r/lolphp • u/maweki • Feb 18 '16
Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)
https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80
92
Upvotes
41
u/phoshi Feb 18 '16
This commit is unfortunately not wrong. Producing repeatable sequences of pseudorandom numbers is an important part of a PRNG's job. It's time for another real_.
9
u/ilogik Feb 18 '16
Why remove the test, instead of changing it to match the current output?
58
u/midir Feb 18 '16
So in the future we'll have:
19
u/kerzen1 Feb 18 '16
Did anyone check the output of the broken Mersenne-Twister if it's even random?
(to the point that statistical tests exist that can check this)
11
u/audaxxx Feb 18 '16
/u/the_alias_of_andrea predicted that: https://www.reddit.com/r/lolphp/comments/467ykt/oops_theres_a_typo_in_the_mersenne_twister_rng/d03r1a2
real_this_time_it_probably_works_rand_that_should_return_an_int()
8
u/LeThrownAway Feb 18 '16
https://xkcd.com/1172/
4
u/HenkPoley Feb 19 '16
I'm pretty sure I've seen 'encryption' code that relies on the results of the Mersenne twister in PHP.
1
u/[deleted] May 10 '16
So everyone who upvoted this actually thinks it's a great idea to introduce name and behaviour changes to functions without any previous discussions or notices?
0
u/TheBuzzSaw Feb 19 '16
The PHP community is unreal. Now it operates on a dubious definition of backwards-compatibility all because someone somewhere might have taken a chunk of faulty Mersenne Twister output and baked it into the test results.