in reply to Re: Shuffle an array
in thread Shuffle an array

Hi BrowserUk,

This doesn't give a fair shuffle. This is well documented, as it is in the FAQ, and is explained well in the Perl Cookbook. A recent node explains it. Check here.

cheers

thinker

Replies are listed 'Best First'.
Re: Re: Re: Shuffle an array
by BrowserUk (Patriarch) on Nov 09, 2002 at 11:14 UTC

    Are you saying my description is inaccurate? If so, please clarify in what way you think that it is wrong.

    My description is accurate. The link you give chooses a random value from 1 to n each time. My description reduces the range by 1 each time. This is the correct Fisher-Yates technique.


    Nah! You're thinking of Simon Templar, originally played (on UKTV) by Roger Moore and later by Ian Ogilvy