[Numpy-discussion] Right behavior
Tim Churches
tchur at optushome.com.au
Fri Mar 29 13:01:15 CST 2002
> Johan Fredrik Øhman wrote:
>
> This code generates very non-random numbers, even when the seed value
> is reinitialized.
> Take a look at the first number in each run !
>
The first numbers in each of your three runs are 7.98493051529 ,
7.98525762558 and 7.98623776436.
They look like different numbers to me. 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.
Tim C
> Is this right ?
>
> --
> JFØ
>
>
> #!/usr/local/bin/python2.1
>
> # Python Virtual clock
> import RandomArray
>
> print "Seed", RandomArray.get_seed()
> for i in range(1000000,10000000,1000000):
> print "Clock at time:" , i/1000000, ":",
> RandomArray.normal(10,2)
>
>
> [root at blekkulf /root]# ./t2.py
> Seed (101743, 1951)
> Clock at time: 1 : 7.98493051529
> Clock at time: 2 : 10.8439420462
> Clock at time: 3 : 7.59234881401
> Clock at time: 4 : 7.32021093369
> Clock at time: 5 : 10.9444898367
> Clock at time: 6 : 10.1128772199
> Clock at time: 7 : 13.1178274155
> Clock at time: 8 : 11.779414773
> Clock at time: 9 : 10.7529922128
> [root at blekkulf /root]# ./t2.py
> Seed (101743, 1953)
> Clock at time: 1 : 7.98525762558
> Clock at time: 2 : 9.38142818213
> Clock at time: 3 : 7.11979293823
> Clock at time: 4 : 10.867649436
> Clock at time: 5 : 9.62882992625
> Clock at time: 6 : 12.1940765381
> Clock at time: 7 : 6.84895467758
> Clock at time: 8 : 8.13472533226
> Clock at time: 9 : 8.15638375282
> [root at blekkulf /root]# ./t2.py
> Seed (101743, 1959)
> Clock at time: 1 : 7.98623776436
> Clock at time: 2 : 14.5040078163
> Clock at time: 3 : 11.3408681154
> Clock at time: 4 : 6.32757425308
> Clock at time: 5 : 8.94617521763
> Clock at time: 6 : 12.1802353859
> Clock at time: 7 : 12.0685124397
> Clock at time: 8 : 10.5330892205
> Clock at time: 9 : 10.9744755626
More information about the Numpy-discussion
mailing list