Ruby random number by day

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

 

Tags: , ,

Leave a Reply