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

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Jun 14 03:22:53 CEST 2006

Terry Jones wrote:

> I was not meaning to say that anyone was wrong, just that I found Greg's
> characterization a bit too general, or not as well defined as it might have
> been.

I meant it in the context being discussed, which was a
shuffling algorithm being used the way shuffling algorithms
are normally used.

To be clear: there is an algorithm with a fixed input and
a single output, and a PRNG whose initial state determines
the actions of the algorithm. The only thing which can
change is the initial state of the PRNG.

> It's clear, I think, from the example code that I and Dan posted, that one
> can move the boundary between the RNG and the algorithm using it.

Only if you correspondingly move the boundary of what
constitutes the initial state. It doesn't matter how
much internal state the algorithm has; if it starts
out in the *same* initial state each time, it can't
increase the number of possible results.

While you probably understood this, it's worth
pointing out explicitly, because some people don't,
or neglect to consider it when thinking about this
sort of situation.


More information about the Python-Dev mailing list