From: Bart Braem Date: 2009-01-23T23:38:11+09:00 Subject: Re: Separate random number generators? On Jan 23, 3:07 pm, Bart Braem wrote: > On Jan 22, 2:20 pm, James Gray wrote: > > > > > On Jan 22, 2009, at 5:39 AM, Bart Braem wrote: > > > > On Jan 22, 12:13 pm, Lars Christensen wrote: > > >> On Jan 22, 11:38 am, Bart Braem wrote: > > > >>> For simulation work, I want to use multiple, independent random   > > >>> number > > >>> generators. Does anyone know up to date implementations? > > > >> What do you mean by independent RNG? Numbers drawn from a single RNG > > >> are usually independent enough. > > > >> Do you mean separate deterministic PRNGs with fixed seeds for > > >> reproducible sequences? Then take a look at this Ruby Quiz: > > > >>http://www.splatbang.com/rubyquiz/quiz.rhtml?id=173_Not_So_Random > > > > I indeed mean separate deterministic PRNGs with fixed seeds for > > > reproducible sequences. Interesting to see this was a Ruby Quiz! Are > > > there solutions without the use of DRb and other libraries? > > > Sure.  See the first solution link on that page (also shown in the   > > quiz write-up). > > > James Edward Gray II > > The first solution is of course not that efficient, I will be > generating lots of random numbers. I'm going to take a look at ruby- > gsl, the ISAAC library gives strange results... > > Thanks for your help! Do not use ISAAC, running this simple test: rng = Crypt::ISAAC.new res = Hash.new() 1.upto(100000) do |i| random = rng.rand larger = (random * 10).to_i res[larger] ||= 0 res[larger] += 1 end 1.upto(10) do |i| puts "hits for #{i}: #{res[i]}" end Shows a large bias towards numbers below 0.4, unless I have an error in this simple script of course. rb-gsl gives problems with installation, I am going to try the Drb solution.