Last active
October 9, 2015 18:45
-
-
Save arkitrave/22178a4caed38faef29e to your computer and use it in GitHub Desktop.
Secret Santa generator
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
function secretSantaGenerator (num) { | |
var participants = _.shuffle(_.range(1, num)); | |
return _.map(participants, function (val, index, list) { | |
return [ | |
val, | |
list[index + 1] ? list[index + 1] : list[0] | |
]; | |
}); | |
} | |
console.log(secretSantaGenerator(10)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated on theReq.