From: Karch Date: 2011-09-20T02:34:17+09:00 Subject: Re: --0015175cabf6e595a704ad4ea871 Content-Type: text/plain; charset=ISO-8859-1 Also you can mod the number by the cardinality of your range and then add your lower bound. On Mon, Sep 19, 2011 at 12:46 PM, Chris White wrote: > > > > > How to generate rand (random number) between two numbers? > > I mean not between 0 and some number. It should be between some number > (not 0) and some number. > > def range_rand(min,max) > min + rand(max-min) > end > > This is the generally utility function I use. Throw in srand with a seed if > you're using it for something related to security. > > Regards, > Chris White > http://www.twitter.com/cwgem > > --0015175cabf6e595a704ad4ea871--