Post Reply 
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

Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Sum of roll of N dice - Joe Horn - 05-02-2018, 05:06 AM
RE: Sum of roll of N dice - Gerald H - 05-02-2018, 05:48 AM
RE: Sum of roll of N dice - pier4r - 05-02-2018, 06:21 AM
RE: Sum of roll of N dice - Jim Horn - 05-02-2018, 07:01 AM
RE: Sum of roll of N dice - pier4r - 05-02-2018, 08:04 AM
RE: Sum of roll of N dice - John Keith - 05-02-2018, 02:07 PM
RE: Sum of roll of N dice - Jim Horn - 05-02-2018, 05:58 PM
RE: Sum of roll of N dice - John Keith - 05-02-2018, 07:18 PM
RE: Sum of roll of N dice - Gerald H - 05-02-2018, 08:01 AM
RE: Sum of roll of N dice - Werner - 05-03-2018, 12:39 PM
RE: Sum of roll of N dice - Gerald H - 05-03-2018, 04:49 PM
RE: Sum of roll of N dice - Werner - 05-03-2018, 05:14 PM
RE: Sum of roll of N dice - Gamo - 05-02-2018, 10:54 AM
RE: Sum of roll of N dice - Joe Horn - 05-02-2018, 12:03 PM
RE: Sum of roll of N dice - Joe Horn - 05-02-2018, 02:00 PM
RE: Sum of roll of N dice - John Keith - 05-02-2018, 07:15 PM
RE: Sum of roll of N dice - Dieter - 05-02-2018, 07:38 PM
RE: Sum of roll of N dice - pier4r - 05-02-2018, 07:44 PM
RE: Sum of roll of N dice - Jim Horn - 05-02-2018, 09:51 PM
RE: Sum of roll of N dice - Csaba Tizedes - 05-03-2018, 08:16 AM
RE: Sum of roll of N dice - SlideRule - 05-04-2018, 12:23 AM
RE: Sum of roll of N dice - Csaba Tizedes - 05-04-2018, 06:09 AM
RE: Sum of roll of N dice - Joe Horn - 05-04-2018, 07:32 AM
RE: Sum of roll of N dice - SlideRule - 05-03-2018, 01:55 PM
RE: Sum of roll of N dice - Gamo - 05-04-2018, 06:27 AM
RE: Sum of roll of N dice - Joe Horn - 05-04-2018, 07:12 AM
RE: Sum of roll of N dice - SlideRule - 05-04-2018, 11:30 AM
RE: Sum of roll of N dice - Michael Zinn - 05-04-2018, 06:35 PM
RE: Sum of roll of N dice - Dieter - 05-04-2018, 08:04 PM
RE: Sum of roll of N dice - Dieter - 05-05-2018, 06:38 PM
RE: Sum of roll of N dice - Dieter - 05-06-2018, 06:12 PM
RE: Sum of roll of N dice - zooropa1844 - 05-06-2018, 10:11 AM
RE: Sum of roll of N dice - zooropa1844 - 05-06-2018, 08:18 PM
RE: Sum of roll of N dice - Dieter - 05-06-2018, 09:02 PM
RE: Sum of roll of N dice - zooropa1844 - 05-06-2018, 09:31 PM
RE: Sum of roll of N dice - pier4r - 05-08-2018, 05:14 PM
RE: Sum of roll of N dice - Allen - 05-11-2018 12:11 AM
RE: Sum of roll of N dice - Allen - 05-11-2018, 01:32 AM
RE: Sum of roll of N dice - zooropa1844 - 05-11-2018, 06:55 AM
RE: Sum of roll of N dice - brickviking - 05-11-2018, 09:52 AM
RE: Sum of roll of N dice - Allen - 05-11-2018, 12:19 PM
RE: Sum of roll of N dice - Thomas Klemm - 06-23-2018, 09:36 PM
RE: Sum of roll of N dice - rprosperi - 06-23-2018, 10:33 PM
RE: Sum of roll of N dice - ttw - 06-24-2018, 01:08 AM



User(s) browsing this thread: 3 Guest(s)