Javascript Array pick()
/*global ROT*///from w w w .j a va 2s .c o m Array.prototype.pick = function () { 'use strict'; if (!this.length) { return null; } return this.splice(ROT.RNG.getUniformInt(0, this.length), 1)[0]; };
Array.prototype.pick = function() { return this[Math.floor(Math.random()*this.length)]; };