Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80401 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60693 invoked from network); 12 Jan 2015 01:20:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Jan 2015 01:20: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.50 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.218.50 mail-oi0-f50.google.com Received: from [209.85.218.50] ([209.85.218.50:61086] helo=mail-oi0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DA/45-34383-35123B45 for ; Sun, 11 Jan 2015 20:20:20 -0500 Received: by mail-oi0-f50.google.com with SMTP id x69so18632521oia.9 for ; Sun, 11 Jan 2015 17:20: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:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=2zz1/dQTx4uUh/AAjLgBL5Gpy0ilkg3M818B8RuoC+c=; b=j7n5kiioMRy7zu8zsX2nRt3BeE83IaecMWXBc8rq3QixRrTHOpzNISERdJmCn8uOrX jMu3F9Ajnn+CTuLkNEZHuBZrQn2WEPDX0zRybD9E5uvXeWPexKL1cFqmclD+3Nduhncz 2H5BdQOPOkWi1JboTlQ1X7hVQIe5Pyn1zyd1WfgPzvT9FAqzMaFmSFZp0FOYlU+7yhkp EwbXKGUCDHFkBb4IXVCtMvBfKy4JO5fe8y4z6HH3ic4rkea7JNDyM378YSX0eIKz4VAo WuKsu6TrJu8uE+I0m+x6bWzZnCbmPESz0PMoU21huOtea2ERAPTITvvzNx3tL35dozi/ phaQ== X-Received: by 10.182.71.73 with SMTP id s9mr16118793obu.15.1421025617092; Sun, 11 Jan 2015 17:20: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 s196sm8282263oie.24.2015.01.11.17.20.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Jan 2015 17:20:16 -0800 (PST) Message-ID: <54B32145.80501@gmail.com> Date: Sun, 11 Jan 2015 17:20: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 CC: Jordi Boggiano , Yasuo Ohgaki , PHP Internals List References: <54B30DB9.3000003@seld.be> <76B8D342-43E7-42E6-AD82-FCF7C5CA8658@ajf.me> <54B31D77.9010100@gmail.com> <976B7B2E-7BC9-4514-ABF3-C0DA3ED98897@ajf.me> In-Reply-To: <976B7B2E-7BC9-4514-ABF3-C0DA3ED98897@ajf.me> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] rand(), mt_rand() and limits From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > The manual explicitly guarantees that code should not rely on the > random number generator being predictable. Where exactly does it say that? The only note I've found is this: http://php.net/manual/en/function.mt-srand.php 5.2.1 The Mersenne Twister implementation in PHP now uses a new seeding algorithm by Richard Wagner. Identical seeds no longer produce the same sequence of values they did in previous versions. This behavior is not expected to change again, but it is considered unsafe to rely upon it nonetheless. Which just says we could change PRNG behavior between versions, and nothing about PRNG not being predictable. > If people want their existing code to continue to work, we could of > course allow this new API to support the C stdlib rand() as an > algorithm for BC reasons. But such code was never supposed to work in > this first place. If it works, breaking it should have a very good reason. I don't see any reason to break srand(). -- Stas Malyshev smalyshev@gmail.com