function shuffle(array) {
    let counter = array.length;
    // While there are elements in the array
    while (counter > 0) {
        // Pick a random index
        const index = Math.floor(Math.random() * counter);
        // Decrease counter by 1
        counter--;
        // And swap the last element with it
        [array[counter], array[index]] = [array[index], array[counter]];
    }
    return array;
}
Shuffle the array using the Fisher-Yates Shuffle.
This method will mutate the original array.

@export
@template T
@param {T[]} array
@returns {T[]}