note 23078 added to function.rand

From: Date: Tue, 09 Jul 2002 00:43:53 +0000
Subject: note 23078 added to function.rand
Groups: php.notes 
Request: Send a blank email to php-notes+get-32774@lists.php.net to get a copy of this message
If you just need a quick way to generate a semi-random list of rows from a table create two random numbers x and y where 1 < x and 0 < y < 3 and then do a query like this: select id from my_table where (id % x = y) limit 20; It's much faster than using rand() and still produces reasonable random results. -- http://www.php.net/manual/en/function.rand.php http://master.php.net/manage/user-notes.php?action=edit+23078 http://master.php.net/manage/user-notes.php?action=delete+23078 http://master.php.net/manage/user-notes.php?action=reject+23078

« previous php.notes (#32774) next »