whrandom seed question

Stelios Kyriacou kyriacou at umbc.edu
Tue Nov 23 15:39:30 EST 1999


Hi, 

I tried today the random number generator in python 
and have the following question: 

Shouldn't the following 3 lines produce the same number? 

>>> whrandom.seed(0,0,0); print whrandom.random() 
0.39613674715 
>>> whrandom.seed(0,0,0); print whrandom.random() 
0.170188890936 
>>> whrandom.seed(0,0,0); print whrandom.random() 
0.831213988577 
>>> 
 

I am used to the matlab randn function which does produce the 
same number since i restart the seed: 
>> rand('seed',0); rand(1)
ans =
    0.2190
>> rand('seed',0); rand(1)
ans =
    0.2190
>> 
 

Am I missing something??? 

Thanks very much in advance. 

Stelios 
  





More information about the Python-list mailing list