![](https://secure.gravatar.com/avatar/ac760526e1285eb6fec38a0799ba84c2.jpg?s=120&d=mm&r=g)
<johanfo@ohman.no> writes: Take a look at the first number in each run !
That is because the random starting seed is (probably, I haven't looked at the code) set from the clock, and doesn't change all that much from run to run. You'll see similar results when you substitute: print "Clock at time:" , i, ":", RandomArray.random_integers(10) or print "Clock at time:" , i, ":", RandomArray.uniform(1, 10) into your code. The part before the decimal point is always the same on the first call of each run (assuming you run them at roughly the same time). Note that the 'seed' is really the internal state of the RNG and changes at each call. You could call the random function a few dozen times before using results, or hash the first result and use that as a new seed, etc. But basically, the generator will produce similar initial results (ie. one call) for similar seeds, which is what the time value is causing. I'd propose that the implementation, when setting the seed from the time, generate at least one dummy RNG generation before returning results. -- Chad Netzer chad.netzer at stanfordalumni.org
participants (1)
-
Chad Netzer