Req #66718 [Ver->Csd]: Please add Mersenne Twister versions of shuffle and array_rand

From: Date: Fri, 09 Sep 2016 02:44:42 +0000
Subject: Req #66718 [Ver->Csd]: Please add Mersenne Twister versions of shuffle and array_rand
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203896@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: yohgaki@php.net Reported by: php at barrayar dot org Summary: Please add Mersenne Twister versions of shuffle and array_rand -Status: Verified +Status: Closed 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: https://wiki.php.net/rfc/rng_fixes Implemented. Previous Comments: ------------------------------------------------------------------------ [2015-08-05 12:18:45] cmb@php.net Using php_mt_rand() for array_rand() seems to be reasonable anyway, to resolve bug #45301. ------------------------------------------------------------------------ [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

« previous php.bugs (#203896) next »