Sum of roll of N dice
|
05-11-2018, 12:11 AM
(This post was last modified: 05-11-2018 12:44 AM by Allen.)
Post: #38
|
|||
|
|||
RE: Sum of roll of N dice
Supposing you know N in advance, it's easy enough to precalculate the probability distribution (as started above).. Then add up the individual probabilities to create an empirical cumulative distribution. Then you can generate 1 random number (from 0 to 1) and get the exact sum of dice just by a lookup table.
For example, if your random number is .855666 go down the cumulative pdr until you find a number greater than the rolled number.. that's your sum. r-nomial coefficients here:https://oeis.org/A063260 sum prob cumulative probability 4 : 1/1296 = 0.000771604938272 0.000771604938272 5 : 4/1296 = 0.00308641975309 0.00385802469136 6 : 10/1296 = 0.00771604938272 0.0115740740741 7 : 20/1296 = 0.0154320987654 0.0270061728395 8 : 35/1296 = 0.0270061728395 0.054012345679 9 : 56/1296 = 0.0432098765432 0.0972222222222 10 : 80/1296 = 0.0617283950617 0.158950617284 11 : 104/1296 = 0.0802469135802 0.239197530864 12 : 125/1296 = 0.096450617284 0.335648148148 13 : 140/1296 = 0.108024691358 0.443672839506 14 : 146/1296 = 0.112654320988 0.556327160494 15 : 140/1296 = 0.108024691358 0.664351851852 16 : 125/1296 = 0.096450617284 0.760802469136 17 : 104/1296 = 0.0802469135802 0.841049382716 18 <---------------------- 0.855666 18 : 80/1296 = 0.0617283950617 0.902777777778 19 : 56/1296 = 0.0432098765432 0.945987654321 20 : 35/1296 = 0.0270061728395 0.97299382716 21 : 20/1296 = 0.0154320987654 0.988425925926 22 : 10/1296 = 0.00771604938272 0.996141975309 23 : 4/1296 = 0.00308641975309 0.999228395062 24 : 1/1296 = 0.000771604938272 1.0 17bii | 32s | 32sii | 41c | 41cv | 41cx | 42s | 48g | 48g+ | 48gx | 50g | 30b |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)