Req #66718 [Ver]: Please add Mersenne Twister versions of shuffle and array_rand
| From: | cmb@php.net | Date: | Wed, 05 Aug 2015 12:18:49 +0000 |
| Subject: | Req #66718 [Ver]: Please add Mersenne Twister versions of shuffle and array_rand | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-194965@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66718&edit=1
ID: 66718
Updated by: cmb@php.net
Reported by: php at barrayar dot org
Summary: Please add Mersenne Twister versions of shuffle and
array_rand
Status: Verified
Type: Feature/Change Request
Package: SPL related
Operating System: Any
PHP Version: Irrelevant
Assigned To: yohgaki
Block user comment: N
Private report: N
New Comment:
Using php_mt_rand() for array_rand() seems to be reasonable
anyway, to resolve bug #45301.
Previous Comments:
------------------------------------------------------------------------
[2014-07-15 12:06:58] yohgaki@php.net
We may simply use php_mt_rand()
------------------------------------------------------------------------
[2014-02-15 01:09:08] php at barrayar dot org
Description:
------------
It would be very helpful if PHP had native Mersenne Twister equivalents for all the various random
functions, e.g. mt_shuffle, mt_array_rand. (I'm not sure if there's any others that would
be relevant.) The MT RNG is superior to the regular srand/rand functions in all respects except
this one. While it's not that hard to implement mt_shuffle and mt_array_rand equivalents in
PHP, they would be faster and more standardized if they were native.
(On a related note, it would also be helpful if PHP had a native class for creating separate RNG
pools, since sometimes you want to be able to recreate a random sequence from a given seed, but
since all mt_rand calls use the same RNG pool, you can't have two concurrent RNG pools.)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66718&edit=1