[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] Efficient shuffle algorithm
From: |
joel reymont |
Subject: |
[Chicken-users] Efficient shuffle algorithm |
Date: |
Mon, 31 Jan 2005 14:53:22 +0000 |
Folks,
How would I efficiently implement this algorithm on a list?
START WITH FRESH DECK
GET RANDOM SEED
FOR CT = 1, WHILE CT <= 52, DO
X = RANDOM NUMBER BETWEEN CT AND 52 INCLUSIVE
SWAP DECK[CT] WITH DECK[X]
I do know that there's the shuffle form in the extras unit but I would
like to implement the algorithm above.
Thanks, Joel
--
http://wagerlabs.com/tech
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Chicken-users] Efficient shuffle algorithm,
joel reymont <=