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
In reply to Re: Randomising an array
by davido
in thread Randomising an array
by tamaguchi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |