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.";
In reply to Re: Re: Fisher-Yates theory
by sauoq
in thread Fisher-Yates theory
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |