FisherYatesKnuth
FisherYatesKnuth, commonly referred to as the Fisher–Yates shuffle or the Knuth shuffle, is an algorithm for generating a random permutation of a finite sequence. It is an in-place procedure, rearranging the input without extra storage, and it aims to produce every permutation with equal probability. The algorithm is named after Ronald A. Fisher and Frank Yates, with its technique popularized by Donald Knuth.
The standard implementation works by iterating over the sequence from the end toward the beginning. For each
The algorithm runs in linear time, O(n), and uses constant extra space, O(1). It requires a source
Naming and usage: the term FisherYatesKnuth reflects the combined attribution; many libraries reference either Fisher–Yates or