[Python-ideas] About adding a new iteratormethodcalled "shuffled"
Imri Goldberg
lorgandon at gmail.com
Fri Mar 27 07:59:34 CET 2009
On Thu, Mar 26, 2009 at 11: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.
I'm a bit rusty on the math, but that doesn't have to be the case. If all
the permutations produced by random.shuffle() form a subgroup, or lie in a
subgroup, then what you'll get is just another permutation from that
subgroup, regardless of the randomness you put inside.
--
Imri Goldberg
--------------------------------------
www.algorithm.co.il/blogs/
--------------------------------------
-- insert signature here ----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090327/3255d320/attachment.html>
More information about the Python-ideas
mailing list