Last active
March 10, 2017 16:41
-
-
Save bobbravo2/645b6257e13aba36bec63ad73d537d0a to your computer and use it in GitHub Desktop.
bcs scraper/groups of 3 randomizer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks!