Skip to content

Instantly share code, notes, and snippets.

@jahschwa
Last active August 6, 2017 00:37
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 jahschwa/d11e9bef4aa5a5dcaeb21bf5c0a6f34e to your computer and use it in GitHub Desktop.
Save jahschwa/d11e9bef4aa5a5dcaeb21bf5c0a6f34e to your computer and use it in GitHub Desktop.
Simulation of dice rolling for ability scores
Roll 4d6, re-roll all ones once, drop lowest
https://github.com/TheSchwa/dnd/blob/master/dice_sim.py
DICE = '4d6'
REROLL = [1]
DROP = 1
SIMS = 1000000
$ python dice_sim.py
4d6 R(1) D1 took 14.858287096 sec
3 = 0.0000 100.00
4 = 0.0012 100.00
5 = 0.0191 100.00
6 = 0.2650 99.98 █
7 = 0.8588 99.71 ██
8 = 1.9835 98.86 ████
9 = 3.9085 96.87 ████████
10 = 6.7161 92.96 █████████████
11 = 9.8238 86.25 ████████████████████
12 = 12.8949 76.42 ██████████████████████████
13 = 14.9287 63.53 ██████████████████████████████
14 = 15.5531 48.60 ███████████████████████████████
15 = 13.8103 33.05 ████████████████████████████
16 = 10.4839 19.24 █████████████████████
17 = 6.2384 8.75 ████████████
18 = 2.5147 2.51 █████
Average: 13.267388
##### Modifiers #####
-4 = 0.0000 100.00
-3 = 0.0203 100.00
-2 = 1.1238 99.98 ██
-1 = 5.8920 98.86 ████████████
0 = 16.5399 92.96 █████████████████████████████████
1 = 27.8236 76.42 ████████████████████████████████████████████████████████
2 = 29.3634 48.60 ███████████████████████████████████████████████████████████
3 = 16.7223 19.24 █████████████████████████████████
4 = 2.5147 2.51 █████
Average: 1.385756
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment