I used to use a slightly more complicated method of getting random values out of the database, until a friend turned me on to MySQL’s “rand()” operator.
Usage in Rails:
class Product
def self.get_random
Product.find(:first, :order => 'RAND()')
end
end
Will get a random product for you out of your database.







