Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115277 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 40103 invoked from network); 2 Jul 2021 18:54:26 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 2 Jul 2021 18:54:26 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DC4BE1804C4 for ; Fri, 2 Jul 2021 12:15:11 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FROM_EXCESS_BASE64, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from smtpbgbr2.qq.com (smtpbgbr2.qq.com [54.207.22.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 2 Jul 2021 12:15:10 -0700 (PDT) X-QQ-mid:Yeas25t1625253300t736t64240 Received: from 08355B1394674FDAAD07A274D17563B1 (me@jhdxr.com [116.14.113.108]) X-QQ-SSF:00100000000000F0FG1000000000000 To: "'Go Kudo'" , "'Nikita Popov'" , "'PHP internals'" References: In-Reply-To: Date: Sat, 3 Jul 2021 03:15:01 +0800 Message-ID: <03e301d76f76$8e2f7d60$aa8e7820$@jhdxr.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Content-Language: en-us Thread-Index: AQFAbvOvKgYq8E6SgWk3/v8H9nv/jAHs4w48AiRQ7aasPYILQA== X-QQ-SENDSIZE: 520 Feedback-ID: Yeas:jhdxr.com:qybgforeign:qybgforeign5 X-QQ-Bgrelay: 1 Subject: RE: [PHP-DEV] [RFC] Add Random Extension (before: Add Random class) From: me@jhdxr.com (=?utf-8?b?Q0hVIFpoYW93ZWk=?=) >> "Why does this method exist at all? When would you use it instead of >> getInt()?" >>=20 > The case for this would be if you want to get a raw unrounded random = number sequence as a number. The situations where this is required would = certainly be limited, but it would be nice to have. (At least, I know of = several production codes that use the result of mt_rand() with no = arguments.) These two methods confused me at first as well, but I think it's ok with = me after I check the documentation of mt_rand(), which also supports = calling without range. So, compatibility is one of the reasons why this = method exists, although I still feel we should find a better name for = them. They are too similar now, you won't be able to tell the difference = without looking into the documentation or source code. Besides the name issue, I have another question for nextInt(). What's = the range of its return? It's not clear in the RFC. The range of = mt_rand() (without min and max) is 0 to mt_getrandmax(), so how about = nextInt()? is there any equivalent method/constant for it? Regards, CHU Zhaowei