in reply to Is there a good way of retrieving entries randomly from a database (MySQL perhaps)?

I'm not sure wheter this is a "better" way than the MySQL order by RAND() function, but of course you could have Perl create a "random" number (see rand) and use something like:

SELECT * FROM table WHERE id=$rand

I assume that you have a column called 'id' which contains a unique number for and $rand contains the random number generated.

You might want to benchmark both methods (and possibly more methods to come) and see what works best.

HTH

--
b10m
  • Comment on Re: Is there a good way of retrieving entries randomly from a database (MySQL perhaps)?
  • Download Code