[Python-Dev] a note in random.shuffle.doc ... (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Sun Jun 11 02:39:42 CEST 2006
- Previous message: [Python-Dev] a note in random.shuffle.__doc__ ...
- Next message: [Python-Dev] a note in random.shuffle.__doc__ ...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Terry Jones wrote:
That doc note should surely be removed. Perhaps it's an artifact from some earlier shuffle algorithm.
The current algorithm (which is simple, well known, and which produces all permutations with equal probability) only calls the RNG len(x) - 1 times.
It's not a matter of how many times it's called, but of how much internal state it has.
A generator with only N possible internal states can't possibly result in more than N different outcomes from any algorithm that uses its results.
-- Greg
- Previous message: [Python-Dev] a note in random.shuffle.__doc__ ...
- Next message: [Python-Dev] a note in random.shuffle.__doc__ ...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]