3 ms·
You can also use any fair dN as a fair dN+X, by rolling ceil(log_N(N+X)) times and interpreting the result as a base-N number. (This is commonly done in D&D: in
by nemo1618 4y ago
You can also use any fair dN as a fair dN+X, by rolling ceil(log_N(N+X)) times and interpreting the result as a base-N number. (This is commonly done in D&D: instead of rolling a d100, you roll two d10s.) For example, say you want to roll a d20, but all you have is a coin. Flip the coin five times, producing a 5-bit integer (again discarding if the sum is not an exact multiple of N+X). A weirder example would be using a d6 to simulate a d100: ceil(log6(100)) = 3, so roll 3 times, then compute 36*r0 + 6*r1 + r2.
Edit: Even more generally, you can use any set of fair dice. Imagine you have a d2, d4, and d6, and you want to simulate a d40. Roll the d6 and multiply by 4*2; roll the d4 and multiply by 2; then roll (flip) the d2. The resulting sum is a fair roll in the range (0, 48]. This is a significant improvement over rolling a d6 three times: you can roll all of the dice together, and you're much less likely to need a reroll.
- TylerE 4y agoInteresting. I'm going to have to build a table to convince myself that the 2/4/6 example works. I'm not saying your wrong - just that combinatorial math (or really math beyond programmer stuff) isn't something I'm an expert in. The bit I'm having trouble with...aren't you missing the low end of the range? Like say you roll a 1 (the lowest possible roll), you'd get, if I understand right, you'd get 14 + 12 + 1*1 = 7. Maybe this works if you subtract one from each roll so they can roll 0?
- aidenn0 4y agoyes, you have to subtract one from each roll