Post Reply 
Sum of roll of N dice
05-02-2018, 07:38 PM (This post was last modified: 05-03-2018 05:50 PM by Dieter.)
Post: #15
RE: Sum of roll of N dice
(05-02-2018 05:06 AM)Joe Horn Wrote:  THE QUESTION: Is there a direct way to return the sum of a roll of N dice without generating N random numbers and adding them together?

Here is another possible method – but I have no idea if it makes sense here. So please correct me if I'm wrong.

Let's assume you roll a really BIG number of dice. Not just 3 or 5, maybe n=10 or 50. According to the central limit theorem this should approximate a Normal distribution. If we assume tossing a single die does not only result in six disctinct outcomes (1, 2, 3, 4, 5, 6) but a continuous result (1...6), the mean is (1+6)/2 = 3,5 and the variance is n · (6–1)²/12. Now simply generate a normally distributed random number, i.e. apply the Normal quantile function (or an approximation thereof) to the usual RAN# result, then rescale it with mean + √var · ran#.

I have tried this on the WP34s and it seems to work fine, even for n as low as 5. Maybe the two parameters require an adjustment (is it 6–1 or 6 in the variance?), but... is the general idea a possible solution, at least for larger n ?

For the record, here is a result for 1000 tosses of 4 dice:

Code:
sum  frequency (w/mod. σ)
-------------------------
4       0         0
5       0         6
6       2        10
7       9        14
8       18       19
9       23       47
10      63       60
11      77       73
12      100      94
13      121     100
14      147     125
15      116      98
16      109      99
17      87       84
18      58       64
19      34       43
20      16       26
21      13       18
22      2         8
23      3         6
24      3         7

Note: the right column shows the frequencies based on the modified variance, i.e. σ² = n · 6²/12.

Edit: for a discrete random variable (1, 2, 3, 4, 5, 6) the variance seems to be 35/12, so I tried another run with σ² = n · 35/12. The results were similar and looked good either.

Dieter
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)