Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80388 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39973 invoked from network); 11 Jan 2015 23:57:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jan 2015 23:57:58 -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.216.49 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.216.49 mail-qa0-f49.google.com Received: from [209.85.216.49] ([209.85.216.49:54122] helo=mail-qa0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 83/E0-34383-40E03B45 for ; Sun, 11 Jan 2015 18:57:56 -0500 Received: by mail-qa0-f49.google.com with SMTP id v8so3409316qal.8 for ; Sun, 11 Jan 2015 15:57:53 -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=d+IOGBhfIhzwwoPs3ssViD0YlTSaOjQsa1xykadS180=; b=w9agM2fwurr9PINhy2TVmwyoaYIGqkVSeEUH+Mc9zbpJtq6/4o2FZApvyZNh1JUHwT mLJx2bf/OzRrjCEHTvpmIbePRBbMefAkEAvn/VW/r/jEjoqny6gdLj2PZvw4AEivYxHX Ne91+4We8ZQBJZIgnhyPA9IaQCjtA1lXsT6nyU+VN8dMSK+5UJ+zEJqmorU9FLUpTD9H BAokaTKe+kwhuUTIFRDxuJxr7cRIWKVI79Q2F7NfmFlTxp11hzjk0cJe20zCWUlIkNN5 bkr3U1z481KyxV1Ih0WCBror0gQm/7nET9N47PC0nLQZV3OsleK2UFHNguT1dRta0olW 4aTA== X-Received: by 10.224.121.79 with SMTP id g15mr34714678qar.68.1421020673893; Sun, 11 Jan 2015 15:57:53 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.229.93.70 with HTTP; Sun, 11 Jan 2015 15:57:12 -0800 (PST) In-Reply-To: References: Date: Mon, 12 Jan 2015 08:57:12 +0900 X-Google-Sender-Auth: W-Jci9etgyPYepSkOwieFPJwYls Message-ID: To: Andrea Faulds Cc: PHP Internals List Content-Type: multipart/alternative; boundary=089e015371d07c6e73050c692839 Subject: Re: [PHP-DEV] rand(), mt_rand() and limits From: yohgaki@ohgaki.net (Yasuo Ohgaki) --089e015371d07c6e73050c692839 Content-Type: text/plain; charset=UTF-8 Hi Andrea, On Mon, Jan 12, 2015 at 7:12 AM, Andrea Faulds wrote: > * 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 > * Make mt_srand() and srand() do nothing and produce a deprecation notice > * Use a 64-bit random number generation algorithm on 64-bit platforms > (or invoke the 32-bit generator twice) > I like your proposal in general. However, I object removal of srand. Game programmers need "the same random sequence" on occasion. There should be srand to get the same sequence for repeatable behaviors. rand()/srand() may be renamed to sys_rand()/sys_srand() (or whatever suitable name for them) in case user needs system random sequence for whatever reasons. I don't insist to keep system's rand/srand, though. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --089e015371d07c6e73050c692839--