in reply to Re: help in understanding the standard array shuffle
in thread help in understanding the standard array shuffle
It would seem this shuffle guarantees that no element remains in it's current position. This seems less than random.
@array= sort { (-1,0,1)[int rand 3]} @array
I suspect you never see this type of thing because
of the inefficiency. The cookbook example is making
length(@foo) or less comparisons, the random sort
is potentially doing more than length(@foo) comparisons.
Update: Hmm...my first statement, after further thought, appears to be silly.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: help in understanding the standard array shuffle
by extremely (Priest) on Feb 14, 2001 at 19:26 UTC | |
by kschwab (Vicar) on Feb 14, 2001 at 19:59 UTC | |
by extremely (Priest) on Feb 14, 2001 at 20:15 UTC | |
|
Re: Re: Re: help in understanding the standard array shuffle
by arhuman (Vicar) on Feb 14, 2001 at 19:21 UTC |