[Python-Dev] a note in random.shuffle.__doc__ ...

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Jun 12 02:27:49 CEST 2006

Terry Jones wrote:

> Suppose you have a RNG with a cycle length of 5. There's nothing to stop an
> algorithm from taking multiple already returned values and combining them
> in some (deterministic) way to generate > 5 outcomes.

No, it's not. As long as the RNG output is the only input to
the algorithm, and the algorithm is deterministic, it is
not possible get more than N different outcomes. It doesn't
matter what the algorithm does with the input.

> If you
> expanded what you meant by "internal states" to include the state of the
> algorithm (as well as the state of the RNG), then I'd be more inclined to
> agree.

If the algorithm can start out with more than one initial
state, then the RNG is not the only input.

> Worse, if you have multiple threads / processes using the same RNG, the
> individual threads could exhibit _much_ more random behavior

Then you haven't got a deterministic algorithm.


More information about the Python-Dev mailing list