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

From: Date: Tue, 14 Mar 2017 13:23:04 +0000
Subject: Doc #74246 [Opn->Ver]: 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-14504@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: Open +Status: Verified Type: Documentation Problem Package: Documentation problem PHP Version: Irrelevant -Assigned To: +Assigned To: peehaa Block user comment: N Private report: N 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 (#14504) next »