Skip to content

Instantly share code, notes, and snippets.

@psiborg
Created January 6, 2012 08:30
Show Gist options
  • Select an option

  • Save psiborg/1569699 to your computer and use it in GitHub Desktop.

Select an option

Save psiborg/1569699 to your computer and use it in GitHub Desktop.
JS Prototype - randomPick
if (!Array.prototype.randomPick) {
Array.prototype.randomPick = function() {
return this[Math.randomFromTo(0, this.length - 1)];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment