Skip to content

Instantly share code, notes, and snippets.

@michalbe
Created April 4, 2015 22:18
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 michalbe/a6a5bdbd20557d26ae32 to your computer and use it in GitHub Desktop.
Save michalbe/a6a5bdbd20557d26ae32 to your computer and use it in GitHub Desktop.
Losowanie druzyn
var people = [
"budzor",
"wojteck",
"aga",
"wasiak",
"luiza",
"luki",
"oktan one",
"paula",
"dżaga"
];
var teams = 3;
var nrOfPeople = 3;
while(teams--) {
document.body.innerHTML += "<br/>TEAM " + (3-teams);
people.sort(function(a, b){
return Math.random() * 1 - 0.5;
});
for (var i =0; i<nrOfPeople; i++) {
document.body.innerHTML += "<br/>" + people.pop();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment