[Tutor] multithreading random()
rdm at rcblue.com
Tue Oct 10 06:23:34 CEST 2006
Please refer to
<http://www.python.org/doc/current/lib/module-random.html>, from which I quote:
"The functions supplied by this module are actually bound methods of
a hidden instance of the random.Random class. You can instantiate
your own instances of Random to get generators that don't share
state. This is especially useful for multi-threaded programs,
creating a different instance of Random for each thread, and using
the jumpahead() method to make it likely that the generated sequences
seen by each thread don't overlap."
Could someone point me to an example script where this was done? I'd
very much like to learn how to do that.
And another question. That page also says, "Almost all module
functions depend on the basic function random(), which generates a
random float uniformly in the semi-open range [0.0, 1.0). Python uses
the Mersenne Twister as the core generator. It produces 53-bit
precision floats and has a period of 2**19937-1." What is a 53-bit
precision float? Would that be something like a float accurate to 8
or 9 figures (dividing 53 by 8). Or what?
More information about the Tutor