Bug #75514 [Opn]: mt_rand returns value outside [$min,$max]+
| From: | remi@php.net | Date: | Mon, 13 Nov 2017 08:19:54 +0000 |
| Subject: | Bug #75514 [Opn]: mt_rand returns value outside [$min,$max]+ | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-212561@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75514&edit=1
ID: 75514
Updated by: remi@php.net
Reported by: remi@php.net
Summary: mt_rand returns value outside [$min,$max]+
Status: Open
Type: Bug
Package: *General Issues
Operating System: 32-bit
-PHP Version: 7.2.0RC6
+PHP Version: 7.1.11
Block user comment: N
Private report: N
New Comment:
7.1 is also affected
Previous Comments:
------------------------------------------------------------------------
[2017-11-13 08:13:09] remi@php.net
Description:
------------
Notice this affects on 32-bit build
Test script:
---------------
php -r 'mt_srand(0, MT_RAND_PHP); var_dump(mt_rand(0,999999999), mt_rand(0,999));'
Expected result:
----------------
# On 64-bit build, this is ok
int(448865905)
int(592)
Actual result:
--------------
int(448865905)
int(-407) # out of range
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75514&edit=1