Skip to content

Instantly share code, notes, and snippets.

@bobbravo2
Last active March 10, 2017 16:41
Show Gist options
  • Save bobbravo2/645b6257e13aba36bec63ad73d537d0a to your computer and use it in GitHub Desktop.
Save bobbravo2/645b6257e13aba36bec63ad73d537d0a to your computer and use it in GitHub Desktop.
bcs scraper/groups of 3 randomizer
var csv = [];
//Parse the names out of BCS attendance page
$("#attendanceHistory tbody tr td:first-child").each(function(k, v) {
csv.push($(v).html())
});
var classSize = csv.length;
//Enter your group sizes here (Thanks @RGtalbot)
var groupSize = 3;
var group = [[], [], [], [], [], [], [], [], []];
for (var i = 0; i < (classSize/groupSize); i ++) {
for (var j = 0; j < groupSize; j ++) {
var rand = Math.floor(Math.random() * csv.length);
var team = csv.splice(rand, 1);
group[i].push(team[0])
}
}
;
$.each(group, function(key, value) {
console.group(key);
console.log(value);
console.groupEnd()
});
@rgtalbot
Copy link

rgtalbot commented Mar 9, 2017

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment