http://qs321.pair.com?node_id=277435


in reply to Fisher-Yates theory

In addition to what sauoq wrote:

I'm not convinced that the Fisher-Yates shuffle actually has very much theory with regard to random order involved at all.

On the surface, each array entry has the appearance of being given a single opportunity at being swapped with another array entry. In practice, array entries nearer to the beginning of the array have additional opportunities of being swapped (as a result of later swaps), meaning that less shuffling happens at the end of the array than at the beginning.

One could argue in great length whether additional shuffling in the array improves the randomness, or whether it produces patterns in the longer term, 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.

UPDATE: See node Fisher-Yates theory... does this prove that it is invalid? for my 'proof' that Fisher-Yates weights the results.