Skip to content

Instantly share code, notes, and snippets.

@webercoder
Last active October 8, 2015 14:07
Show Gist options
  • Select an option

  • Save webercoder/3342614 to your computer and use it in GitHub Desktop.

Select an option

Save webercoder/3342614 to your computer and use it in GitHub Desktop.
Order and Chaos Giveaway Picker
function getRandom(min, max) {
var randomNum = Math.random();
console.log(min + ', ' + max + ', ' + randomNum);
return min + Math.floor(Math.random() * (max - min + 1));
}
function getPlayer() {
var shadowRiders = ['user', 'list', 'here'];
var min = 1;
var max = shadowRiders.length;
var index = getRandom(min, max);
return shadowRiders[index - 1];
}
console.log(getPlayer());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment