Post Reply 
(11C) Roll "Four" Dice at Random
10-16-2018, 09:17 PM (This post was last modified: 10-17-2018 09:38 PM by Albert Chan.)
Post: #13
RE: (11C) Roll "Four" Dice at Random
Prove: For RAN# = 0, 1/10^n, 2/10^n, ... (10^n-1)/10^n, evenly distributed,
and Dice = INT(6 RAN#) + 1, then dice face 3,6 will appear slightly less often.

10^n - 1 sum of digits = 0, thus divisible by 9, thus divisible by 3
10^n - 1 is odd

=> 10^n - 1 (mod 6) = 3, so 10^n = 6 k + 4 = 6(k + 2/3), for some integer k

Below, use Python definition of range(a,b), i.e. a <= integer value < b:

Dice face 1: range(0, k+2/3) = range(0, k+1), total k+1 cases
Dice face 2: range(k+1, 2k+4/3) = range(k+1, 2k+2), total k+1 cases
Dice face 3: range(2k+2, 3k+6/3) = range(2k+2, 3k+2), total k cases
Dice face 4: range(3k+2, 4k+8/3) = range(3k+2, 4k+3), total k+1 cases
Dice face 5: range(4k+3, 5k+10/3) = range(4k+3, 5k+4), total k+1 cases
Dice face 6: range(5k+4, 6k+12/3) = range(5k+4, 6k+4), total k cases

QED

Edit: above assumed calculation had enough precision to avoid rounding issue.
If calculation is also carried to n digits precision, dice face 2,4 will appear less often.
Upper range limit reduced a bit due to possible half-round-up

Dice face 1: range(0, k+2/3-0.5/6) = range(0, k+1), total k+1 cases
Dice face 2: range(k+1, 2k+4/3-5/6) = range(k+1, 2k+1), total k cases
Dice face 3: range(2k+1, 3k+6/3-5/6) = range(2k+1, 3k+2), total k+1 cases
Dice face 4: range(3k+2, 4k+8/3-5/6) = range(3k+2, 4k+2), total k cases
Dice face 5: range(4k+2, 5k+10/3-5/6) = range(4k+2, 5k+3), total k+1 cases
Dice face 6: range(5k+3, 6k+12/3-5/6) = range(5k+3, 6k+4), total k+1 cases

Example, k=166, (2k+1)/(6k+4) = 0.333, 0.333 * 6 = 1.998, rounded-up to 2.00 (dice face 3)
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 09:17 PM



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