Nodejs Utililty Methods Array Random

List of utility methods to do Array Random

Description

The list of methods to do Array Random are organized into topic(s).

Method

randomize()
Array.prototype.randomize = function() {
  this.sort(function() {
    return Math.floor(Math.random() * 2) ? -1 : 1;
  });
  return this;
randomize()
Array.prototype.randomize = function()
  var i = this.length, j, temp;
  while ( --i )
    j = Math.floor( Math.random() * (i - 1) );
    temp = this[i];
    this[i] = this[j];
    this[j] = temp;
...