note 6076 modified in function.shuffle by irc-html

From: Date: Sat, 19 Jan 2002 22:10:20 +0000
Subject: note 6076 modified in function.shuffle by irc-html
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-25509@lists.php.net to get a copy of this message
Shuffle doesn't work very well. Especially if you're shuffling mySQL rows...use rand() instead, like: $num = rand(0,count($rows)-1); $row = $rows[$num]; Hope this helps..took me a while to debug it and figure out that shuffle favors some numbers over others... --was-- Shuffle doesn't work very well. Especially if you're shuffling mySQL rows...use rand() instead, like: <pre> $num = rand(0,count($rows)-1); $row = $rows[$num]; </pre> Hope this helps..took me a while to debug it and figure out that shuffle favors some numbers over others... http://www.php.net/manual/en/function.shuffle.php

« previous php.notes (#25509) next »