-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Description
The documentation for the shuffle() function in the random module expresses concern that, for sequences of length larger than 2080, the shuffle() function is not able to produce all permutations of the sequence. While true, I find the emphasis on the finite period of the Mersenne Twister random number generator misleading, since the generator is only called n-1 times for a sequence of length n. The real issue is that any algorithm based on a sequence of calls to a pseudorandom number generator will not be able to generate more permutations than the generator has internal states.
(I also wonder how large of a sequence can be sent to shuffle() in practice, to be guaranteed a uniform distribution over permutations. Is 2079 small enough? 2078? Might there be a check for this?)
Linked PRs
Metadata
Metadata
Assignees
Labels
Projects
Status