Re: shuffling elements of a list



David C Ullrich enlightened us with:
I thought that the fact that you could use the same trick for
_shuffling_ a list was my idea, gonna make me rich and famous. I
guess I'm not the only one who thought of it. Anyway, you can use
DSU to _shuffle_ a list by decorating the list with random numbers.

This is often done in database queries that need to randomize the data
;-)

Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
.



Relevant Pages

  • Re: shuffling elements of a list
    ... _shuffling_ a list was my idea, gonna make me rich and famous. ... The problem with the world is stupidity. ... DSU seems like a lot of trouble to go through in order to use an O(n ... The core code of random.shuffleshows how easy it is ...
    (comp.lang.python)
  • Re: shuffling elements of a list
    ... _shuffling_ a list was my idea, gonna make me rich and famous. ... David C. Ullrich ...
    (comp.lang.python)