Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80400 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59118 invoked from network); 12 Jan 2015 01:12:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Jan 2015 01:12:20 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.54 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.218.54 mail-oi0-f54.google.com Received: from [209.85.218.54] ([209.85.218.54:48513] helo=mail-oi0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B4/F4-34383-37F13B45 for ; Sun, 11 Jan 2015 20:12:20 -0500 Received: by mail-oi0-f54.google.com with SMTP id u20so18543216oif.13 for ; Sun, 11 Jan 2015 17:12:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=MJhRf3cE+zhskn/ObSkAcMIJ1GIbRINARYApE8VrHoc=; b=CwnAm5j0R9JozVtstby45amH597xTm+culLfVPSE4shQWPrTRkY4kgur2FTkM8lGAb Wz/6SBybo7jBCRkWLzAWOS8dWjV7vT+vs8eoh3sdItLZ53Y1dYQAGooIwtGTsuj7x8h1 mJIFBtaAIlX7TWLwG/i6ltJcaTSqA4iVMgAAVIb7P8reqXpEbeiIHGk375eqej4mt8qr Ai4TR4t7uDMD1I1KaSyen6w55kug4/KBi8uLnx6Wuk0AS7IoDnqS0HjRUuKEu1CgM1TT mgHE83+0uS7n5sx9vNSv4URn9gumgVMwLNd5pw1xrrs7y4SIH8xeM6kLnHDDVvq4bqnB /BqQ== X-Received: by 10.182.27.207 with SMTP id v15mr15962494obg.21.1421025137464; Sun, 11 Jan 2015 17:12:17 -0800 (PST) Received: from [192.168.2.102] (108-66-6-48.lightspeed.sntcca.sbcglobal.net. [108.66.6.48]) by mx.google.com with ESMTPSA id h66sm1260765oib.25.2015.01.11.17.12.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Jan 2015 17:12:17 -0800 (PST) Message-ID: <54B31F65.90203@gmail.com> Date: Sun, 11 Jan 2015 17:12:05 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Andrea Faulds , PHP Internals List References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] rand(), mt_rand() and limits From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > * Get rid of rand(), srand() and getrandmax() * Rename mt_rand(), > mt_srand() and mt_getrandmax() to rand(), srand(), and getrandmax() > but add mt_* aliases for backwards-compatibility This means rand() and mt_rand() would do the same. That however assumes that OS's libc random-number functions are and will always be inferior. Is that the case that we believe? In any case, I would rather disclaim any specifics about implementation of rand() other than saying it is using best algorithm we have. If we decide MT one is the best we can support, so be it. > * Make mt_srand() > and srand() do nothing and produce a deprecation notice I think this is not a good idea. While we can not guarantee the PRNG we use always provides the same values for the same srand on every system for every version, it is the case that it provides them in the same environment, thus enabling the possibility of testing random-driven algorithms. Disabling it precludes any such testing, except with user-level workarounds, which will inevitably be more brittle and error-prone. This all is for no observable gain. * Use a > 64-bit random number generation algorithm on 64-bit platforms (or > invoke the 32-bit generator twice) This sounds like a good idea, though it may have BC implications. Is there a use case we know of where it matters? -- Stas Malyshev smalyshev@gmail.com