ethers.js/packages/random/shuffle.js
2019-05-14 18:48:48 -04:00

14 lines
369 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function shuffled(array) {
array = array.slice();
for (var i = array.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var tmp = array[i];
array[i] = array[j];
array[j] = tmp;
}
return array;
}
exports.shuffled = shuffled;