jeudi 1 juin 2017

Generate a random number with a seed between a range in ruby

I'm trying to get the banner image on my website to change once a day. I can see ruby has srand which will let me input a number for the date and return the same result every time it is called on the same day but this returns a very long number. I also saw rand lets me use a range like rand(a..b).

Is there any way I can use srand with a range like I can with rand?




Aucun commentaire:

Enregistrer un commentaire