List of utility methods to do Array Random
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; ... |