Here you can find the source of random(last)
Array.prototype.random = function(last) { var num = 0;// www . ja v a 2 s. c o m do { num = Math.floor(Math.random() * this.length); } while (this[num] == last); return this[num]; }
Array.prototype.random = function() { return this[Math.floor(Math.random() * this.length)]; Number.prototype.toPrice = function() { return this.valueOf().toFixed(2).replace(/./g, function(c, i, a) { return i && c !== "." && !((a.length - i) % 3) ? "," + c : c; });
Array.prototype.random = function(){ return this[Math.round(Math.random()*(this.length-1))]
Array.prototype.random = function() return this[Random(0, this.length - 1)];
Array.prototype.random = function() { if (this.length == 0) return void 0; return this[Math.floor(Math.random() * this.length)]; };
Array.prototype.random = function(i) { var random = []; for(; i > 0;) { random.push(this[Math.random() * this.length | 0]); i--; return random; }; var usedNames = {}; ...
Array.prototype.random = function(nelm) { nelm = nelm || 1; if (nelm <= 0) { nelm = 1; if (nelm === 1) { return this[Math.floor(Math.random() * this.length)]; var ret = [], i; ...
Array.prototype.random = function(num, enableDuplicate){ var array = []; var duplicate; if(typeof duplicate === "undefined"){ duplicate = false; else{ duplicate = enableDuplicate; if(num <= this.length){ var index; for(var i=0; i<num; i++){ index = Math.floor(Math.random()*this.length); array.push(this[index]); if(!enableDuplicate){ this.splice(index, 1); return array; module.exports = Array;
Array.prototype.randomElement = function () { return this[Math.floor(Math.random() * this.length)]
function Weather() { this.currentWeather = ['stormy', 'sunny', 'sunny', 'sunny'].randomElement(); Array.prototype.randomElement = function () { return this[Math.floor(Math.random() * this.length)]; };