ethers.js/packages/random/lib/shuffle.js

15 lines
431 B
JavaScript
Raw Permalink Normal View History

2019-05-14 18:48:48 -04:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
2021-03-07 18:24:04 -05:00
exports.shuffled = void 0;
2019-05-14 18:48:48 -04:00
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;
2020-07-13 08:03:56 -04:00
//# sourceMappingURL=shuffle.js.map