rails:freeze:gems | freezzo.com

May 9, 2008

Ruby random number by day

Filed under: Ruby on Rails — Tags: , , — Randy @ 5:06 pm

This is a cool little snippet of code that will return a random number, that changes by day:

def random_by_day(max_value)
    srand Time.now.strftime("%m%d%Y").to_f
    rand(max_value)
end

Powered by WordPress