Re: shuffling elements of a list
- From: SuperHik <junkytownMAKNI@xxxxxxxxx>
- Date: Wed, 31 May 2006 12:12:01 +0200
greenflame wrote:
Zhang Fan wrote:You should update your Python then ;)On 30 May 2006 20:18:19 -0700, greenflame <alikakakhel@xxxxxxxxx> wrote:Second of all, I would like to haveThe random module has a `shuffle' method. It "Shuffle the sequence x
other methods of shuffling, prefererably riffle shuffling and just
plain randomly arranging the elements of the list.
in place".
It may be help for you
I am sorry but this does not help much. In my version of python (2.3)
this method does not seem to exist. Also from the documentation, it
seems that this method would give a random number.
It's a very nice method:
>>> import random
>>> random.seed()
>>>
>>> list = [1,21,23,4,5]
>>> random.shuffle(list)
>>> print list
[5, 4, 23, 1, 21]
.
- References:
- shuffling elements of a list
- From: greenflame
- Re: shuffling elements of a list
- From: Zhang Fan
- Re: shuffling elements of a list
- From: greenflame
- shuffling elements of a list
- Prev by Date: Re: Best Python Editor
- Next by Date: Re: Best Python Editor
- Previous by thread: Re: shuffling elements of a list
- Next by thread: Re: shuffling elements of a list
- Index(es):