Req #66718 [Opn->Ver]: Please add Mersenne Twister versions of shuffle and array_rand
Edit report at https://bugs.php.net/bug.php?id=66718&edit=1
ID: 66718
Updated by: yohgaki@php.net
Reported by: php at barrayar dot org
Summary: Please add Mersenne Twister versions of shuffle and
array_rand
-Status: Open
+Status: Verified
Type: Feature/Change Request
Package: SPL related
Operating System: Any
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
We may simply use php_mt_rand()
Previous Comments:
------------------------------------------------------------------------
[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
Thread (4 messages)