[Numpy-discussion] printable random seed ?
Neal Becker
ndbecker2 at gmail.com
Wed Sep 22 10:32:22 EDT 2010
josef.pktd at gmail.com wrote:
> I would like to generate random numbers based on a random seed, for
> example what numpy.random does if the seed is not specified. But I
> would also like to print out the initial state, so I can replicate the
> random numbers.
>
> Can I get a human readable or printable version of the initial state?
> Alternatively, what's a good way to randomly generate an initial
> state?
>
> I could draw an integer with randint and use it as seed. Is this the best
> way?
>
> Josef
import struct
import os
seed = struct.unpack ('I', os.urandom (4))[0]
print seed
More information about the NumPy-Discussion
mailing list