[SciPy-user] weird behaviour in scipy.random seed
Giovanni Samaey
Giovanni.Samaey@cs.kuleuven...
Tue Apr 24 07:35:10 CDT 2007
Hi,
I am seeing the following weird behaviour when seeding the random number
generator in scipy.random.
The basic idea is that it gives an error when I take the seed out of a
scipy array of integers, but works fine
when I cast them to standard python integers. (See code below.)
Should I file a ticket for this? Does anyone have the same?
Giovanni
from scipy import random as R
a=R.RandomState(seed=0) # this is OK
a=R.RandomState(seed=0.) # this gives an error, which is OK
ValueError: object of too small depth for desired array
Now I try the following
x = scipy.arange(500)
x[0].dtype # this says 'int64'
a=R.RandomState(seed=x[0]) # this again give an error, which is not OK
ValueError: object of too small depth for desired array
Casting to int, resolves the problem:
a=R.RandomState(seed=int(x[0])) # this does not give an error.
More information about the SciPy-user
mailing list