Random Array Sort?

From: Date: Fri, 18 Oct 2002 18:43:13 +0000
Subject: Random Array Sort?
Groups: php.general 
Request: Send a blank email to php-general+get-120545@lists.php.net to get a copy of this message
I looked in the guide and couldn't find an easy way to do this, like a multisort, so I thought I'd ask here and see if anyone can point me to the command or share code if they've done something like this. I have an array with numbers in the fields, say 1, 2, 3, 4 and 5 in the first 5 slots. Now I want to sort them, but randomly. The only way I could think to do this is to create a loop, run it a random number of times, and in the loop, swap two random elements. Can anyone think of an easier/more logical way? -- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Email: skeller@healthtvchannel.org Web: www.healthtvchannel.org

« previous php.general (#120545) next »