[SciPy-user] RandomArray behaving nondeterministically
Fernando Perez
Fernando.Perez at colorado.edu
Fri Jul 30 17:12:15 CDT 2004
bulatov at cs.orst.edu wrote:
> For some reason RandomArray gives different results when initialized with the
> same seed. IE
>
>
>>>>import RandomArray as r
>>>>r.seed(0,0)
>>>>r.uniform(0,1,(3,3))
>
> array([[ 0.9445683 , 0.81778226, 0.27272533],
> [ 0.53688906, 0.27386963, 0.39699606],
> [ 0.83909219, 0.66436204, 0.23828671]])
>
>>>>r.seed(0,0)
>>>>r.uniform(0,1,(3,3))
>
> array([[ 0.94409458, 0.54127862, 0.78580418],
> [ 0.74310646, 0.67297207, 0.6716389 ],
> [ 0.60675857, 0.54727364, 0.67690952]])
>
> Is that a feature, or a bug?
A feature, according to the docs:
In [8]: r.seed?
Type: function
Base Class: <type 'function'>
String Form: <function seed at 0x2a3dc3ac>
Namespace: Interactive
File: /usr/lib/python2.3/site-packages/Numeric/RandomArray.py
Definition: r.seed(x=0, y=0)
Docstring:
seed(x, y), set the seed using the integers x, y;
Set a random one from clock if y == 0
You are seeding with the clock :)
Best,
f
More information about the SciPy-user
mailing list