in reply to Re: Fisher-Yates theory
in thread Fisher-Yates theory
One could argue in great length whether additional shuffling in the array improves the randomness, or whether it produces patterns in the longer term,
If your RNG was perfect, additional shuffles would neither improve or degrade the randomness.
but it isn't difficult to argue that regardless of which conclusion is valid, the fact that the entries nearer to the beginning have additional chances of being shuffled, while entries nearer the end have fewer chances, that *one* of these ends will be improved more than the other, therefore the algorithm is not optimal.
Unless neither conclusion is valid (see above) in which case a single shuffle is no better or worse than multiple shuffles and the algorithm is optimal.
In practice, however, our RNGs aren't perfect and you may have a point. I suppose you could resolve it by keeping track of the original indexes of the elements and then apply your map and do a second FY shuffle starting with the previous last and moving backwards to the previous first... still linear in time and space... but I doubt it is worth it. :-)
-sauoq "My two cents aren't worth a dime.";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Fisher-Yates theory
by Abigail-II (Bishop) on Jul 24, 2003 at 08:25 UTC | |
|
(Re:)+ Fisher-Yates theory
by rir (Vicar) on Jul 24, 2003 at 12:58 UTC | |
by Abigail-II (Bishop) on Jul 24, 2003 at 13:16 UTC |