Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97813 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99376 invoked from network); 17 Jan 2017 14:59:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jan 2017 14:59:28 -0000 Authentication-Results: pb1.pair.com header.from=lauri.kentta@gmail.com; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=lauri.kentta@gmail.com; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain gmail.com does not designate 178.62.210.197 as permitted sender) X-PHP-List-Original-Sender: lauri.kentta@gmail.com X-Host-Fingerprint: 178.62.210.197 k-piste.dy.fi Received: from [178.62.210.197] ([178.62.210.197:58204] helo=k-piste.dy.fi) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 44/55-00729-0513E785 for ; Tue, 17 Jan 2017 09:59:28 -0500 Received: from localhost.localdomain ([::1] helo=k-piste.dy.fi) by k-piste.dy.fi with esmtp (Exim 4.88) (envelope-from ) id 1cTVEK-00021o-Uf; Tue, 17 Jan 2017 16:59:24 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Tue, 17 Jan 2017 16:59:24 +0200 To: Yasuo Ohgaki Cc: internals@lists.php.net In-Reply-To: <142a3537a99809cf23d78e0eaadc3aef@gmail.com> References: <71c26cd6df6f59e76dafd31647852c2e@koti.fimnet.fi> <142a3537a99809cf23d78e0eaadc3aef@gmail.com> Message-ID: <7a359bb08b0ad8b046534c15492cec91@gmail.com> X-Sender: lauri.kentta@gmail.com User-Agent: Roundcube Webmail/1.2.3 Subject: Re: [PHP-DEV] Re: Improving mt_rand() seed From: lauri.kentta@gmail.com (=?UTF-8?Q?Lauri_Kentt=C3=A4?=) On 2017-01-17 16:18, Lauri Kenttä wrote: > On 2017-01-17 02:34, Yasuo Ohgaki wrote: >> Set state somewhere between MT rand's 2^19937−1 cycle. > > This is exactly what my patch does. 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ä