Hmm, your quote from the MySQL manual seems to work. Only I'm twisting it a little to use RAND(?) and I pass a Perl-generated rand :) It's still not quite as random as I would like, but it's definately better. As to the console select statement test, sorry but that failed (diff number each time), but with perl passing different rand numbers most of the time, it's interesting at least.
Modified Code:
my $sth = $state->{'DBH'}->prepare('SELECT quote,author FROM quotes
+ ORDER BY RAND(?) LIMIT 1');
$sth->execute(rand(10000));
my $row = $sth->fetchrow_arrayref;
$sth->finish;
My code doesn't have bugs, it just develops random features.
Flame ~ Lead Programmer: GMS (DOWN) | GMS (DOWN) |