Doc #74246 [Ver->Csd]: Clarify that although rand() is an alias for mt_rand() it has BC differences

From: Date: Mon, 03 Apr 2017 14:57:34 +0000
Subject: Doc #74246 [Ver->Csd]: Clarify that although rand() is an alias for mt_rand() it has BC differences
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-14577@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74246&edit=1 ID: 74246 Updated by: peehaa@php.net Reported by: peehaa@php.net Summary: Clarify that although rand() is an alias for mt_rand() it has BC differences -Status: Verified +Status: Closed Type: Documentation Problem Package: Documentation problem PHP Version: Irrelevant Assigned To: peehaa Block user comment: N Private report: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2017-03-14 13:22:40] peehaa@php.net Description: ------------ As of 7.1 rand() is mostly an alias of mt_rand. This is explained in the doc notes http://php.net/manual/en/function.rand.php. However it does have some difference to preserve BC. See also the user note @ http://php.net/manual/en/function.rand.php#120782: From PHP 7.1 rand() is documented as an alias of mt_rand(). Actually, if they are called with two arguments where the second is smaller than the first, their output differs. For example var_dump(rand(2,1), mt_rand(2,1)); may return Warning: mt_rand(): max(1) is smaller than min(2) int(2) bool(false) where rand() will return a random value between $max and $min Expected result: ---------------- Clarify taht rand() isn't an exact alias. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74246&edit=1

« previous php.doc.bugs (#14577) next »