Re: PHP 7.1.0 to 7.2.0beta2 mt_rand() modulo bias bug
| From: | Solar Designer | Date: | Thu, 07 Sep 2017 19:41:04 +0000 |
| Subject: | Re: PHP 7.1.0 to 7.2.0beta2 mt_rand() modulo bias bug | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-100455@lists.php.net to get a copy of this message | ||
On Thu, Sep 07, 2017 at 08:23:22PM +0200, Nikita Popov wrote:
> Sorry for the long delay. I've just applied
>
> https://github.com/php/php-src/commit/fd07302024bc47082b13b32217147fd39d1e9e61
> to the 7.2 branch.
Thank you!
Maybe you'd add similar tests for 64-bit ranges? Right now,
rand_range64()'s bias avoidance is left untested. Need to come up with
numbers that would demonstrate the bias if the bias-avoiding loop
failed.
Also, the comment (by me, in the test) that says "7.1.0 to 7.2.0beta2"
should now say "7.1.0 to 7.2.0beta3" since beta3 was released with the
bug still intact.
Alexander