in reply to Randomising an array
You need to know this: The shuffle() routine implemented in List::Util is a fair shuffle; It is an implementation of the fisher-yates shuffle. Other recipies such as yours are not certain to be 'fair'. I don't know if yours is biased or not, but why leave it to chance when there's a perfectly good alternative built into a module that comes with Perl? I do know that it is very easy to get it wrong when writing an unbiased shuffle routine. Good thing someone included a fair, unbiased shuffle in List::Util
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Randomising an array
by blokhead (Monsignor) on Aug 04, 2006 at 16:19 UTC |