Re: Re: Improving mt_rand() seed
| From: | Lauri Kenttä | Date: | Tue, 17 Jan 2017 14:59:24 +0000 |
| Subject: | Re: Re: Improving mt_rand() seed | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-97813@lists.php.net to get a copy of this message | ||
On 2017-01-17 16:18, Lauri Kenttä wrote:
On 2017-01-17 02:34, Yasuo Ohgaki wrote:Or, to be honest, my patch provides 2^19936 possible states, which should be more than enough. To get all 2^19937−1, you would need to get one more bit of entropy (2^19936 to 2^19937) and then check that the state is not all zeros (which is the −1 in 2^19937−1). That's certainly not worth the trouble, so I just set that one "extra" bit to 1. (MT doesn't work if the state is all zeros.) -- Lauri KenttäSet state somewhere between MT rand's 2^19937−1 cycle.This is exactly what my patch does.