Node.js examples for Array:Shuffle
Shuffle array element
(function(){/*from ww w .j av a2s . c o m*/ Array.prototype.shuffle = function(){ for (i = 0; i<this.length/2; i++){ var j = Math.floor(Math.random()*this.length); var temp = this[i]; this[i] = this[j]; this[j] = temp; } return this; } })();