From: Karch Date: 2011-09-20T22:39:57+09:00 Subject: Re: --0015174a0a843ed5bc04ad5f9892 Content-Type: text/plain; charset=ISO-8859-1 My bad. I assumed errantly that ruby's rand would default return a rand number bounded by int size. Too much C++ for me :P Thanks for the correction! In Christ, Karch On Tue, Sep 20, 2011 at 4:02 AM, Robert Klemme wrote: > On Mon, Sep 19, 2011 at 7:34 PM, Karch wrote: > > Also you can mod the number by the cardinality of your range and then add > > your lower bound. > > That's not a workable approach: > > 09:56:29 Temp$ ruby19 -e 'p rand' > 0.13646702557098767 > > So you need to use rand with an integer argument - and if you do that > there is no point in picking another value than the range size. > You'll end up with the solution Chris proposed. > > Kind regards > > robert > > -- > remember.guy do |as, often| as.you_can - without end > http://blog.rubybestpractices.com/ > > --0015174a0a843ed5bc04ad5f9892--