Puzzled about random initialisation

Paul Rubin http
Thu Jul 8 21:14:13 CEST 2004

Robin Becker <robin at SPAMREMOVEjessikat.fsnet.co.uk> writes:
> I'm not sure that answers my question. The seed in question is
> supposed to be determinate.
> The docs say system time is used as an initial seed and my reading of
> the code seems to suggest that the actual input is a single time_t
> value which apparently changes once per second.

No, the input is the system timer including the microseconds, and it
may include some other stuff as well.  The system timer doesn't really
change a million times a second, but it changes much faster than 1 hz.

> However, I would still like to know how random starting a python
> process and taking a single randint value is?  Can someone clever
> guess what values will be thrown up in a specified system time second?

Yes, pretty much so.  If that's a concern for your application, you
should not depend on the MT algorithm even if the initial state is secret.

The patch attached to


has a much more secure (but slower) PRNG with the same interface as the
library PRNG, if you want to use that.

More information about the Python-list mailing list