From: Wild Karl-Heinz Date: 2003-06-26T16:35:56+09:00 Subject: Re: Inconsistent rand() results with MySQL Ruby (long) Hallo Dave, In message "Inconsistent rand() results with MySQL Ruby (long)" on 25.06.2003, Dave Dembinski writes: DD> %links = my.query('select id from links order by rand() * 10 limit DD> 10;') DD> % DD> %links.each_hash do |row| DD> %print row['id'] DD> %print "
" DD> %end I've tried with dbd and dbi-mysql seems good. require 'dbi' dbh = DBI.connect( 'DBI:Mysql:db', 'user', 'pass' ) dbh.execute('select usr_aid from user order by rand() limit 10;') do |stm | stm.fetch do | row | print row[ 'usr_aid' ], "\n" end end 777 1055 568 870 652 215 514 44 89 954 1091 540 276 845 365 762 883 899 443 41 -- Mit freundlichen Gruessen, Wild Karl-Heinz kh.wild at wicom.li