Javascript Array getRandomElement()

Description

Javascript Array getRandomElement()


Array.prototype.getRandomElement = function() {
 var i = getRandBetween(0, this.length-1);
 return this[i];//  w  w w. j a  v a  2s.  c  om
}

Javascript Array getRandomElement()

Array.prototype.getRandomElement = function()
{
    var n = this.getRandomIndex()
    return this[n]
}



PreviousNext

Related