Skip to content

Instantly share code, notes, and snippets.

@myano
Created May 21, 2015 14:37
Show Gist options
  • Save myano/46325dbd706a27197b46 to your computer and use it in GitHub Desktop.
Save myano/46325dbd706a27197b46 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import random
dice_numbers = dict()
dice = range(1, 7)
total = 1500000
for x in range(0, total):
temp = random.choice(dice) + random.choice(dice)
if temp not in dice_numbers:
dice_numbers[temp] = 0
dice_numbers[temp] += 1
print('Done!')
for x in range(2, 13):
print('%s: %s -- %.2f' % (x, dice_numbers[x], float(dice_numbers[x]) / total * 100.0) + '%')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment