|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-10-28 00:35 UTC] andrei@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 08:00:01 2025 UTC |
<!-- short reproducible error script srand ((double) microtime() * 10000000); $count = sizeof($files); $rand_keys = array_rand ($files, $count); reset ($files); while (list ($key, $val) = each ($rand_keys)) { echo "$key -> $val<br>\n"; } //--> The nature of the bug is in tryign to create a random distribution of the entire array. The function works perfectly provided the second parameter to the array_rand function is less than the total number of elements. If the second parameter is equal to the total number of elements i nthe array, then the result of array_rand is identical to the initial array.