From: Bart Braem Date: 2009-01-24T00:53:24+09:00 Subject: Re: Separate random number generators? On Jan 23, 4:33 pm, "F. Senault" wrote: > Le 23 janvier 2009 à 15:59, Bart Braem a écrit : > > > On Jan 23, 3:34 pm, Lars Christensen wrote: > >> I do think that my own solution (last on the page) is efficient, but i > >> can't vouch for the statistical properties (it reseeds the Mersenne > >> Twister in Ruby every time a number is drawn, although randomly). > > > I've tested this setup, with just one RNG. Running my unit tests is > > about 5 times slower, unfortunately. I am calling the random number > > very often, more than 10.000 times in 10 seconds in a simulation that > > uses the standard kernel rand. > > I can't afford this slowdown, but it seems as though there are no > > other solutions that do not use a pure-ruby library? > > Can you estimate the number of random numbers you'll need ?  Maybe you > could pre-generate sequences of numbers in a few arrays, then patch the > rand method to actually read the array instead of generating the > number ? > > The start time and memory consumption will be a lot higher, but maybe it > makes a good compromise ? > That is an idea, but quick calculations show the need of up to 100.000 random numbers. Which is quite a lot to calculate and most importantly store and retrieve again.