Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91383 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8959 invoked from network); 24 Feb 2016 22:10:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Feb 2016 22:10:30 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.180 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.160.180 mail-yk0-f180.google.com Received: from [209.85.160.180] ([209.85.160.180:33360] helo=mail-yk0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FE/F1-27730-35A2EC65 for ; Wed, 24 Feb 2016 17:10:27 -0500 Received: by mail-yk0-f180.google.com with SMTP id z13so14404392ykd.0 for ; Wed, 24 Feb 2016 14:10:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=TfkjWn95+7gko6ZH4ILuBqYL8K7sV2q5RJbmuxnO3jk=; b=ednsar3LbDwLTjGSNZW2B/kab73vNiud71JAarTFkJw0ecL6v+C6HjaO/S3kGyjw2R MRAQIH/3kM+EqVKyqc/EBvbdfwHm3fv9o2EROyulEWZfYSdXvxpAkQ/bJi8FEZ69WCRH zVr7t+EyFUxCU0dIxmHh20+CJM60jI6NkGAT+xavUKcUESHV6SAPM++Me9g7GJeyEt3X j4jZhbeP9FHvdRk7l3+y42DZZ2RN/yXTPXsoYD8/bEMmYY4GMRk+ZHdMuPhGhXf3Op+t 0s1uceNHzZr5amOpOMnkgS8Rq3oHI6VQBbS1a9qUd91LMfHzZBnNqg/KuZ1TJAqGx89Q RU9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type; bh=TfkjWn95+7gko6ZH4ILuBqYL8K7sV2q5RJbmuxnO3jk=; b=a9vJcDYly/OTKFR/hweBOle0g2ftVfLu+auGEOxmQt0iOU0oCZVkFScLmzlHejtaCP fwUZxFslWm3XcghWLlKO9Vh/PubO5JAom3etYHkdL0p63Zv142e1GRgxKX/Yx7UEpKeW NcOEfQRcRciLKmblK75cLy+LNwH1RDhsQmDDRvdmJc7wG7TR8gwH2G3WiE0CBzPXoq7a zTTFpZQB3aEft/MYhQ0MYiOZTAIJLTF6T9QfRzYLNJREbuIEtIWtJ0DnhjPSdQhj+HCc 76GXtN6JIw7bMQ/B3owrfKqbxundzVSSWR9UUqBZLStJ3RxEpI8cw+ELtb49UCmQ8ffh mRxA== X-Gm-Message-State: AG10YORMYdiosQQpUn7awuW8HU0BRrTFmOJAu5TOcUhOEj/Auk/75NOmYpG5nyv3FrcapYN+anrgEXvDinkwCA== X-Received: by 10.37.20.195 with SMTP id 186mr22622452ybu.60.1456351825227; Wed, 24 Feb 2016 14:10:25 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.129.109.22 with HTTP; Wed, 24 Feb 2016 14:09:45 -0800 (PST) In-Reply-To: References: Date: Thu, 25 Feb 2016 07:09:45 +0900 X-Google-Sender-Auth: 2bEVQHfT0oMDNCCW5J2SxS6Q-cI Message-ID: To: Nikita Popov Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Re: PRNG: Raise warning and/or provide better pseudo random generator? From: yohgaki@ohgaki.net (Yasuo Ohgaki) Hi all, On Thu, Feb 25, 2016 at 6:31 AM, Yasuo Ohgaki wrote: >> I think it would be preferable to wait a bit -- there's clearly interest in >> replacing rand/mt_rand etc with a higher quality PRNG, so maybe lets give >> people time to create a proposal for that before we start throwing warnings. > > Reasonable suggestion! > Adding warnings is trivial. It could done before RC. > I'll wait until then. I updated the doc for the time being. http://svn.php.net/viewvc?view=revision&revision=338662 MT rand range is 2^32, but our mt_rand() implementation is 2^31. http://lxr.php.net/xref/PHP_5_6/ext/standard/rand.c#331 Because RAND_RANGE() macro simply does arithmetic on supplied parameters, out of range values result in biased numbers. Therefore, I replaced mt_rand() caution to my warning. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net