From: Henry Maddocks Date: 2007-01-07T06:43:54+09:00 Subject: Re: HOW-TO produce random numbers within a range? --Apple-Mail-1-834079680 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed On 7/01/2007, at 8:02 AM, Rodrigo Bermejo wrote: > def rand(min,max) > until min < r=old_rand(max); end > return r > end Don't do this. It is *really* inefficient. Compare these... 10.times do |x| p rand(10000000,10000005) # Your new slow rand end 10.times do |x| p rand(5) + 10000000 # old rand end --Apple-Mail-1-834079680--