php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #12312 Add array_mt_rand()
Submitted: 2001-07-22 21:23 UTC Modified: 2015-02-17 09:03 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: lramsey at crystalorb dot net Assigned:
Status: Wont fix Package: Arrays related
PHP Version: * OS: *
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2001-07-22 21:23 UTC] lramsey at crystalorb dot net
As the mt_rand() algorithim creates better random numbers than rand(), would it be possible to include in future releases of the language to include a version of array_rand() that uses mt_rand()?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-31 10:37 UTC] andrey@php.net
Does array_shuffle() solve this?
 [2003-06-06 14:54 UTC] sniper@php.net
There is no 'array_shuffle()' and shuffle() uses rand too.
Having array_mt_rand() is quite good idea. 


 [2003-06-06 17:33 UTC] philip@php.net
Why not just rewrite array_rand() and shuffle() to instead use mt_srand()?  It is "superior" after all...  And seeding takes place automatically as of PHP 4.2.0
 [2003-06-25 12:02 UTC] jay@php.net
There's a patch for php-src HEAD at 
 
http://bugs.tutorbuddy.com/download.php/php5.array_mt_rand.patch 
 
Adds array_mt_rand(). Rewriting the existing functions 
would be bad for BC if anybody is relying on their current 
behaviour. 
 
J 
 [2010-12-31 21:13 UTC] jani@php.net
-Summary: array_mt_rand() ? +Summary: Add array_mt_rand() -Package: Feature/Change Request +Package: Arrays related -Operating System: Linux 2.4.3 +Operating System: * -PHP Version: 4.0.6 +PHP Version: *
 [2015-02-17 09:03 UTC] krakjoe@php.net
-Status: Open +Status: Wont fix
 [2015-02-17 09:03 UTC] krakjoe@php.net
array_rand does still use the same random number generator today, I checked.

What was true in 2003, is still true today in 2015, it would be a breaking change.

The introduction of a new function today requires an RFC, I'm therefore marking the bug as won't fix.

This report can still be found if some future RFC is started for the inclusion of the suggested function.

Sorry about the wait.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 06:01:30 2024 UTC