Node.js examples for Number:Random Number
Random permutation
/* random permutation */ Array.prototype.shuffle = function() { for (var i = this.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); var temp = this[i]; this[i] = this[j];/*from www . jav a 2 s. com*/ this[j] = temp; } };