Skip to content

Instantly share code, notes, and snippets.

@ryantuck
Last active March 1, 2017 17:57
Show Gist options
  • Save ryantuck/80271a10e3ef209dacf11bad5355923b to your computer and use it in GitHub Desktop.
Save ryantuck/80271a10e3ef209dacf11bad5355923b to your computer and use it in GitHub Desktop.
from __future__ import division
from collections import Counter
import itertools
import six
n_dice = 6
n_sides_per_die = 6
options = range(1, n_sides_per_die+1)
all_combos = itertools.product(*(n_dice*[options]))
uniques = [len(set(c)) for c in all_combos]
c = Counter(uniques)
for k,v in c.items():
print('{0: <2} | {1: >10} | {2}'.format(k, v, v/len(uniques)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment