[Numpy-discussion] Right behavior

Tim Churches tchur at optushome.com.au
Fri Mar 29 14:51:03 EST 2002


Johan Fredrik Øhman wrote:
> 
> The first numbers in each of your three runs are 7.98493051529 ,
> 7.98525762558 and 7.98623776436.
> They look like different numbers to me.
> 
> First, thanks for your answer Time.
> I do agree, they are different.  But I wouldn't call it random.  I didn't expect
> that the small difference in the initial seed would affect the first number with so little.
> Usually the seed numbers I have experienced other places have much more
> dramatic effect on the numbers,  if you see what I mean...

OK, you need to use Konrad Hinsen's excellent RNG module which comes
with Numeric Python:
#################################
# Python Virtual clock
import RNG

dist = RNG.NormalDistribution(10, 2)
rng = RNG.CreateGenerator(0, dist)
for i in range(1000000,10000000,1000000):
	print "Clock at time:" , i/1000000, ":", rng.ranf()
##################################

The above code gives 8.46183655136,  7.29889782477 and 5.58243682462 as
the first values in three successive runs on my system.

Hope this helps,

Tim C

> 
> If you want the difference
> between initial values to be greater, you need to make the
> difference in your seeds greater. For example, if I run your code now, I
> get 8.29225027561, 8.29484963417 and 8.29744851589, but setting the seed
> to (1,2) gives an initial value of 5.69397783279. Remember, these are
> only pseudorandom numbers.
> 
> Yes, they are pseudorandom and that is OK.  What I just want is some more
> initial difference between the runs without setting the seed number manually.
> But know I know this is not a flaw in the RNG, but "its the way it is supposed to be"
> 
> Thanks
> 
> --
> Johan Fredrik Ohman
> 
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion




More information about the NumPy-Discussion mailing list