php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71152 mt_rand() returns the different values from original mt19937ar.c
Submitted: 2015-12-17 19:13 UTC Modified: 2016-02-18 18:21 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: kusano4a at gmail dot com Assigned:
Status: Closed Package: *Math Functions
PHP Version: master-Git-2015-12-17 (Git) OS: All
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kusano4a at gmail dot com
New email:
PHP Version: OS:

 

 [2015-12-17 19:13 UTC] kusano4a at gmail dot com
Description:
------------
mt_rand() returns the different values from original mt19937ar.c.
Although mt_rand() is required to be generate random numbers, I am concerned about that this difference implies possibly deterioration of randomness quality.


Test script:
---------------
<?php
mt_srand(12345678);
for ($i=0; $i<10; $i++)
    echo mt_rand().PHP_EOL;


Expected result:
----------------
527860569
1711027313
1280820687
688176834
770499160
412773096
813703253
898651287
52508912
757323740


Actual result:
--------------
1614640687
1711027313
857485497
688176834
1386682158
412773096
813703253
898651287
2087374214
1382556330


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-02-17 03:35 UTC] laruence@php.net
Automatic comment on behalf of kusano@users.noreply.github.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6f6bd8ce531636134efd5f669a4e8373fb2e9e51
Log: Fix #71152: mt_rand() returns the different values from original mt19937ar.c
 [2016-02-17 03:35 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2016-02-17 03:35 UTC] laruence@php.net
Automatic comment on behalf of kusano@users.noreply.github.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d31e8a9a85efea54db0b647424f6c4485d71db8b
Log: Fix #71152: mt_rand() returns the different values from original mt19937ar.c
 [2016-02-18 11:13 UTC] leigh@php.net
Automatic comment on behalf of leigh
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a0724d30817600540946b41e40f4cfc2a0c30f80
Log: Revert &quot;Fix #71152: mt_rand() returns the different values from original mt19937ar.c&quot;
 [2016-02-18 11:26 UTC] leigh@php.net
Automatic comment on behalf of leigh
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a0724d30817600540946b41e40f4cfc2a0c30f80
Log: Revert &quot;Fix #71152: mt_rand() returns the different values from original mt19937ar.c&quot;
 [2016-02-18 18:21 UTC] ab@php.net
-Status: Closed +Status: Re-Opened
 [2016-02-18 18:21 UTC] ab@php.net
Reopen as the patch is reverted.

Thanks.
 [2016-04-18 09:30 UTC] bwoebi@php.net
Automatic comment on behalf of kusano@users.noreply.github.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d31e8a9a85efea54db0b647424f6c4485d71db8b
Log: Fix #71152: mt_rand() returns the different values from original mt19937ar.c
 [2016-04-18 09:30 UTC] bwoebi@php.net
-Status: Re-Opened +Status: Closed
 [2016-07-20 11:33 UTC] davey@php.net
Automatic comment on behalf of leigh
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a0724d30817600540946b41e40f4cfc2a0c30f80
Log: Revert &quot;Fix #71152: mt_rand() returns the different values from original mt19937ar.c&quot;
 [2016-07-20 11:33 UTC] davey@php.net
Automatic comment on behalf of kusano@users.noreply.github.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6f6bd8ce531636134efd5f669a4e8373fb2e9e51
Log: Fix #71152: mt_rand() returns the different values from original mt19937ar.c
 [2016-07-20 11:34 UTC] davey@php.net
Automatic comment on behalf of kusano@users.noreply.github.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d31e8a9a85efea54db0b647424f6c4485d71db8b
Log: Fix #71152: mt_rand() returns the different values from original mt19937ar.c
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 20:01:29 2024 UTC