face-api/build/ops/shuffleArray.js

15 lines
468 B
JavaScript
Raw Normal View History

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.shuffleArray = void 0;
function shuffleArray(inputArray) {
2020-08-18 14:04:33 +02:00
const array = inputArray.slice();
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
const x = array[i];
array[i] = array[j];
array[j] = x;
}
return array;
}
exports.shuffleArray = shuffleArray;
2020-08-18 14:04:33 +02:00
//# sourceMappingURL=shuffleArray.js.map