On Thu, Jul 13, 2006 at 12:39:50AM +0900, khaines / enigo.com wrote: > def fp_rand(limit) > fl = limit.floor > rm = limit.remainder(fl) > rand(fl) + rand(rm) > end > > > fp_rand(12.73) > => 10.1895547681143 <nitpicking> That method would never return values whose decimal part >= 0.73 in the above example. Besides, the variance of the resulting random variable would be lower than for the correct limit * rand(): (fl^2 + rm^2) / 12 instead of (fl + rm)^2 / 12 = limit^2 / 12 </nitpicking> -- Mauricio Fernandez - http://eigenclass.org - singular Ruby