Last active
August 29, 2015 14:06
-
-
Save lmullen/999d7862bee71a29bc39 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
</head> | |
<body> | |
<script src="assign-groups.js"></script> | |
</body> | |
</html> |
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
var clio = ["Mandy", "Sara", "Anne", "George", "Peter", "Janelle", "Allison"]; | |
// to shuffle an array | |
console.log(clio); | |
var shuffled = d3.shuffle(clio); | |
console.log(clio); | |
console.log(shuffled); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
</head> | |
<body> | |
<script src="select-student.js"></script> | |
</body> | |
</html> |
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
var clio = ["Mandy", "Sara", "Anne", "George", "Peter", "Janelle", "Allison"]; | |
// Hint: First write a function that generates a random integer. | |
// Yes, JavaScript should include that in the standard library, but it | |
// doesn't. I've provided such a function hundreds of lines below if you want | |
// a shortcut. | |
var selectStudent = function(participants) { | |
// Do something | |
// Then return some value | |
return ; | |
} | |
// Finally we call the function with our data | |
console.log(selectStudent(clio)); | |
/* | |
* Return a random integer between two values | |
*/ | |
function randomInt(min, max) { | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment