Post Reply 
(11C) Roll "Four" Dice at Random
10-16-2018, 04:20 PM (This post was last modified: 10-16-2018 06:13 PM by Albert Chan.)
Post: #12
RE: (11C) Roll "Four" Dice at Random
(10-15-2018 06:33 PM)Thomas Klemm Wrote:  >>> dice_dist(1000, 1)
{0: 167, 1: 167, 2: 166, 3: 167, 4: 167, 5: 166}

I noticed that for decimal random numbers, (i.e n = 10^k, k positive), dice of 3 and 6 is biased down.
(assumed generated dice = INT(6 RAN#) + 1, so below 0 meant dice face of 1)

>>> dice_dist(10000, 1)
{0: 1667, 1: 1667, 2: 1666, 3: 1667, 4: 1667, 5: 1666}

>>> dice_dist(100000, 1)
{0: 16667, 1: 16667, 2: 16666, 3: 16667, 4: 16667, 5: 16666}

>>> dice_dist(1000000, 1)
{0: 166667, 1: 166667, 2: 166666, 3: 166667, 4: 166667, 5: 166666}

Is this always true ?

(10-16-2018 08:37 AM)Thomas Klemm Wrote:  It turns out that multiplying the random number by 64 and then translating the integer part to base 6 is the same as
multiplying it continuously by 6, chopping off the integer part and continue with the remainder ...

But then it's slightly longer and a bit biased so rather don't use it at all.

Comparing against unbiased distribution, I was unable to measure a bias difference.
This is my reference unbiased distribution (first number for sum of 4, last for 24)

unbiased = [ 1 4 10 20 35 56 80 104 125 140 146 140 125 104 80 56 35 20 10 4 1 ]

this pattern look familiar ...

Update: above match coefficient of expanded (x^5 + x^4 + x^3 + x^2 + x + 1)^4
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 04:20 PM



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