Created
September 21, 2015 16:30
-
-
Save jdfitzgerald/b672566a889751877d1e to your computer and use it in GitHub Desktop.
This file contains 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
/* | |
Grab a list of 10 random males from bamboohr (for random stuff from the random committee) | |
To use go here: https://websummit.bamboohr.co.uk/employees/directory.php | |
Then run the script below in the console, modifying the filter and the for loop to control | |
the initial selection and the total number | |
*/ | |
// shuffle yoinked from stack overflow | |
function shuffle(array) { | |
var currentIndex = array.length, temporaryValue, randomIndex ; | |
while (0 !== currentIndex) { | |
randomIndex = Math.floor(Math.random() * currentIndex); | |
currentIndex -= 1; | |
temporaryValue = array[currentIndex]; | |
array[currentIndex] = array[randomIndex]; | |
array[randomIndex] = temporaryValue; | |
} | |
return array; | |
} | |
// data is an array of all employees on the employee directory | |
people = data.filter(function(e) { if (e.gender=='Male') return e; }); | |
shuffle(people); | |
selection=[]; | |
for (i=0;i<10;i++) { | |
selection.push(people[i].displayName); | |
} | |
console.log(selection); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment