note 28832 added to function.rand
| From: | Hitek at lvcm dot com | Date: | Sat, 25 Jan 2003 09:34:09 +0000 |
| Subject: | note 28832 added to function.rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-42720@lists.php.net to get a copy of this message | ||
Just a note on using mysql RAND(). I tested this on a win2k server running mysql 3.23.52, and, using
a table with 20 rows, querying 20 times using the "order by RAND() limit 1" directive
returned only (one of) the last 3 rows.
Theoretically, this should have given me one occurence of each row (or some close approximation
thereof)
I don't know if this is a bug in mysql in general, or only the NT build, but until I learn
otherwise, I'll stick to using php RAND().
--
http://www.php.net/manual/en/function.rand.php
http://master.php.net/manage/user-notes.php?action=edit+28832
http://master.php.net/manage/user-notes.php?action=delete+28832
http://master.php.net/manage/user-notes.php?action=reject+28832