Source

array/shuffle.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.shuffle = void 0;
/**
 * Shuffles array in place.
 *
 * Reference: https://stackoverflow.com/questions/6274339/how-can-i-shuffle-an-array
 *
 * @param {Array} a items An array containing the items.
 * @category array
 * @module shuffle
 */
function shuffle(a) {
    var j;
    var x;
    var i;
    for (i = a.length - 1; i > 0; i--) {
        j = Math.floor(Math.random() * (i + 1));
        x = a[i];
        a[i] = a[j];
        a[j] = x;
    }
    return a;
}
exports.shuffle = shuffle;
exports.default = shuffle;