Skip to content

Instantly share code, notes, and snippets.

@lmullen
Last active August 29, 2015 14:06
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 lmullen/999d7862bee71a29bc39 to your computer and use it in GitHub Desktop.
Save lmullen/999d7862bee71a29bc39 to your computer and use it in GitHub Desktop.
<!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>
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);
<!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>
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