UNPKG

layer-oriented-deep-learning-network-js

Version:

A feed-forward neural network with injectable layers, activation functions, and optimizers.

25 lines (20 loc) 565 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = arrayShuffle; function arrayShuffle(array) { var counter = array.length; // While there are elements in the array while (counter > 0) { // Pick a random index var index = Math.floor(Math.random() * counter); // Decrease counter by 1 counter--; // And swap the last element with it var temp = array[counter]; array[counter] = array[index]; array[index] = temp; } return array; }