H
Hans Georg Schaathun
I wonder if someone knows of an API with the features I need...
random.Random and numpy.random each have only half of it...
My application includes an object to hold a pseudo-randomly
generated matrix too large to be kept in memory. Hence I
try to store only the seed, and generate the numbers on the fly.
This can be done by giving the object an instance of random.Random.
As far as I can see, numpy.random has a global state, and thus
cannot be used by several concurrent random-matrix objects.
My problem is that random.Random is much slower than numpy.random.
(Three times slower in a small test.) I believe this is because
numpy.random can return a row at a time, while random.Random only
return scalars (as far as I have seen).
Can anyone recommend a PRNG which supported multiple instances
with independent states, and that also can return numpy.array (or
something similar) efficiently?
The distribution is currently Gaussian.
Thanks in advance,
:-- George
random.Random and numpy.random each have only half of it...
My application includes an object to hold a pseudo-randomly
generated matrix too large to be kept in memory. Hence I
try to store only the seed, and generate the numbers on the fly.
This can be done by giving the object an instance of random.Random.
As far as I can see, numpy.random has a global state, and thus
cannot be used by several concurrent random-matrix objects.
My problem is that random.Random is much slower than numpy.random.
(Three times slower in a small test.) I believe this is because
numpy.random can return a row at a time, while random.Random only
return scalars (as far as I have seen).
Can anyone recommend a PRNG which supported multiple instances
with independent states, and that also can return numpy.array (or
something similar) efficiently?
The distribution is currently Gaussian.
Thanks in advance,
:-- George