[Python-ideas] About adding a new iterator methodcalled "shuffled"

Antoine Pitrou solipsis at pitrou.net
Wed Mar 25 12:06:06 CET 2009


Greg Ewing <greg.ewing at ...> writes:
> 
> > In addition, the F-Y shuffle is limited by the period of the random 
> > number generator:
> 
> *All* shuffling algorithms are limited by that.
> 
> Think about it: A shuffling algorithm is a function
> from a random number to a permutation. There's no
> way you can get more permutations out than there are
> random numbers to put in.

The period of the generator should be (much) larger than the number of possible
random numbers, because of the generator's internal state.
(I'm not sure I understood your sentence as you meant it though)





More information about the Python-ideas mailing list