Zorgatone
4/14/2015 - 1:01 PM

Get random array element, directly from the object

Get random array element, directly from the object

/**
 * Get random array element, directly from the object
 */
Array.prototype.random = Array.prototype.random || function random() {
    return this[Math.floor(Math.random() * this.length)];
};