[Python-ideas] About adding a newiteratormethodcalled "shuffled"

Raymond Hettinger python at rcn.com
Thu Mar 26 19:36:28 CET 2009


>> Is it or is it not broken?  That's all I want to know.  "maybe" isn't
>> good enough.  "Not broken for small lists" implies it IS broken for
>> large lists.
>> 
>> Disabling it (raising an exception for large lists) is of course just
>> a stopgap measure.  Better would be a PRNG with a much larger period..
>> but of course that'd require more CPU time and more seed.
> 
> It's only broken in a theoretical sense.  It's fun to think about, but I
> wouldn't lose any sleep over it.

It's not even broken in a theoretical sense.  It does exactly what it says it does.

Besides, this whole conversation is somewhat senseless.  You can't get any
more randomness out of a generator than you put into the seed in the
first place.  If you're not putting thousands of digits in your seed, then
no PRNG is going to give you an equal chance of producing every possible
shuffle for a large list.


Raymond



 "Anyone who considers arithmetical methods of producing random digits is, of course, in a state of sin."  --  John von Neumann 



More information about the Python-ideas mailing list