Skip to content

Instantly share code, notes, and snippets.

@tixxit
Last active August 29, 2015 14:17
Show Gist options
  • Save tixxit/55a194730c6b868bcb03 to your computer and use it in GitHub Desktop.
Save tixxit/55a194730c6b868bcb03 to your computer and use it in GitHub Desktop.
def combos(numDice: Int, sides: Int): List[List[Int]] = {
if (numDice > 0) {
for {
h <- (1 to sides).toList
t <- combos(numDice - 1, sides)
} yield {
h :: t
}
} else {
List(Nil)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment