|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-09-17 22:08 UTC] iliaa@php.net
[2002-10-04 17:23 UTC] matthias dot thalmann at sciontec dot com
[2002-11-04 16:34 UTC] catch at sonaware dot net
[2002-11-04 18:43 UTC] iliaa@php.net
[2002-11-20 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 14:00:01 2025 UTC |
I called array_rand($my_array, count($my_array)). I expected array_rand to return the keys of $my_array in random order. I actually received the keys in almost the same order each time. $my_array was a 4 element array and the third element's key never changed position. I tried using srand also, but it produced same results. On an older version of php(4.1.2) the function worked as expected. script on WinXP php4.2.3: $numbers = range (1,4); $rand_keys = array_rand ($numbers, count($numbers)); foreach ($rand_keys as $val) { print $numbers[$val]."\n"; }