Re: [RFC] RNG fixes
| From: | Tom Worster | Date: | Wed, 15 Jun 2016 12:41:15 +0000 |
| Subject: | Re: [RFC] RNG fixes | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-94004@lists.php.net to get a copy of this message | ||
On 6/15/16 6:33 AM, Pierre Joye wrote:
* Alternatively, fixing the current mt_rand() implementation to make it standard That sounds more reasonable. An option (please no ini as it is a programatic flow feature, not a php configuration problem) to keep the old behavior for BC. Having to add an option for 7.1 or 7.2+ is reasonable enough for the cases where the current seed and predictable sequences are desired (same data generations for example using one seed for example).Hi Pierre, I'm glad you mentioned a compatibility mode. Let's say we would offer:
int mt_rand ( $mode = MT_RAND_COMPAT )
int mt_rand ( int $min, int $max, $mode = MT_RAND_COMPAT )
MT_RAND_COMPAT = 1
MT_RAND_MT19937 = 2A PHP user needs to make the right choice of what to use in their situation. A technical description of the modes would be confusing and unhelpful to most users. I have no idea how to document this simply, honestly and accurately, and without jumping to conclusions about suitability. This is why I think a compat/correct mode switch doesn't improve PHP. It's inconsistent with the spirit set out in the preamble of "PHP RFC: Your Title Here"[1]. [1] https://wiki.php.net/rfc/template Similarly, the $mode arg allows us to add MT_RAND_XOROSHIRO128_PLUS or whatever (interesting to some of us, more "modern", perhaps arguably more "strong" or are otherwise "better") aren't improvements to PHP unless users are asking for them. Tom