[Python-ideas] About adding a new iteratormethodcalled "shuffled"

Adam Olsen rhamph at gmail.com
Thu Mar 26 22:25:58 CET 2009


On Thu, Mar 26, 2009 at 2:19 PM, Jan Kanis <jan.kanis at phil.uu.nl> wrote:
> Just out of curiosity, would doing
>
> l = range(2082)
> random.shuffle(l)
> random.shuffle(l)
>
> give me (with a high probability) one of those permutations that is
> unreachable with a single shuffle? If so, I'd presume you could get
> any shuffle (in case you really cared) by calling random.shuffle
> repeatedly and reseeding the prng in between.

If you reseed, yes.  That injects new entropy into the system.  As I
said though, you can end up needing megabytes of entropy.


-- 
Adam Olsen, aka Rhamphoryncus



More information about the Python-ideas mailing list