Skip to content

Instantly share code, notes, and snippets.

@Ryanb58
Created December 29, 2014 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ryanb58/860731db2a9ffdf4896c to your computer and use it in GitHub Desktop.
Save Ryanb58/860731db2a9ffdf4896c to your computer and use it in GitHub Desktop.
Simple script that records it's history so as not to repeat itself two times in a row...
var gameMaster = "Ryanb58";
var listOfPlayers = ['Taylor','Ryanb58','Jack','John','Kyle'];
var playerNumber;
for(i=0; i<25; i++)
{
//console.log("Current GM: " + gameMaster);
playerNumber = listOfPlayers.indexOf(gameMaster);
while(gameMaster == listOfPlayers[playerNumber])
{
//max(exclusive) min(inclusive) --> Math.floor(Math.random() * (max - min) + min);
playerNumber = Math.floor(Math.random() * listOfPlayers.length);
}
gameMaster = listOfPlayers[playerNumber];
console.log(i + ") " + listOfPlayers[playerNumber]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment