Post Reply 
(11C) Roll "Four" Dice at Random
10-16-2018, 12:17 AM
Post: #10
RE: (11C) Roll "Four" Dice at Random
(10-15-2018 06:33 PM)Thomas Klemm Wrote:  
(10-15-2018 04:29 PM)Albert Chan Wrote:  For 3 dice rolls, dice distribution = 80*4 + 136*5. 5/4 = 1.25 is unacceptably bad.

How did you come up with this distribution?

My mistake. I was assuming a dice with 216 faces.
When the numbers are split back into 3 dice rolls, the distribution is not as bad.

1000 = 216 * 4 + 136 = (216-136) * 4 + 136*5 = 80*4 + 136*5

Doing sum of 3 dice rolls in Mathematica (again, assume RAN# = 0.000 to 0.999):

Code:
dice3[n_] := 3 + Plus @@ IntegerDigits[Mod[n, 216], 6]

biased = Table[dice3[i], {i, 0, 999}]
biased = Table[Count[biased, i], {i, 3, 18}]  (* list should sum to 1000 *)
==> {5, 15, 30, 50, 74, 102, 120, 128, 125, 113, 93, 64, 41, 24, 12, 4}

unbiased = Table[dice3[i], {i, 136, 999}]     (* drop 1000 % 216 numbers *)
unbiased = Table[Count[unbiased, i], {i, 3, 18}]
==> {4, 12, 24, 40, 60, 84, 100, 108, 108, 100, 84, 60, 40, 24, 12, 4}

ratio = biased * (1-0.136) / unbiased

ratio = {1.08, 1.08, 1.08, 1.08, 1.07, 1.05, 1.04, 1.03, 1., 0.98, 0.96, 0.92, 0.89, 0.86, 0.86, 0.86}

Biased distribution is skew to the small side, as expected.
Also, roll sum of 16,17,18 is much less likely ... So, bet small Big Grin

Quote:That means 0 (i.e. [1, 1, 1]) can never happen?

To get random integers from RAN#, I do not use INT(216 RAN#); I use (1000 RAN#) % 216 instead.
If generated random range is divisible by 216, all are equally likely.
That was the reason to drop 1000 % 216 = 136 small cases.

Had I done above biased simulation with INT(216 RAN#), distribution is better (relative to unbiased)
It seems INT(...) produce enough randomness to compensate ...

ratio = {1.08, 1.08, 0.97, 0.95, 1.07, 0.99, 0.97, 1.03, 1.02, 0.97, 1.00, 1.05, 0.93, 0.97, 1.08, 0.86}
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(11C) Roll "Four" Dice at Random - Gamo - 10-13-2018, 03:32 AM
RE: (11C) Roll "Four" Dice at Random - Albert Chan - 10-16-2018 12:17 AM



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