The Fisher-Yates shuffle has an off-by-one.
i = Math.random() * n-- | 0;
generates a value less than n.And
t = array[n];
array[n] = array[i];
array[i] = t;
is using a decremented n.You are being confused by the `n--` in the random selection.