While looking at this question, I had a gut feeling that you can use any fair, single die with any number of sides to calculate the outcome of any probability.
Assuming we express the probability as a range of numbers, this is easy for coins and d10s: coins can be flipped to generate a binary number, while d10s can be rolled to produce each digit of the outcome. If the result falls outside the range, ignore it and reroll.
This is really just probability with respect to base. The coin generates a result in base 2, while the d10 generates results in base 10. Therefore, a die with a number of sides n can be used to produce a result in base n.
Now consider that we have an arbitrary number of dice, each with an arbitrary number of sides. We could generate an outcome by expressing the result of each die roll in base 2 and tacking them together* (see example). This would however result in a lot of rerolling, and is otherwise time-consuming when you factor in converting to base 2 and so forth.
So here's what amounts to a somewhat silly puzzle question:
- For an arbitrary set of dice, each with an arbitrary number of sides, is there a general method for determining the outcome of any probability while minimizing the number of rerolls.
- Is there a method which is easy to remember and could reasonably be used during a gaming session (i.e. takes less than, say, 30 seconds to determine which dice to roll and calculate the result).
Example of presented method: Outcome between 0 and 993, with (hypothetical) 1d7 and 1d21.
- 993 in base 2 is 1111100001, meaning we need 10 binary digits to express the full range of possible outcomes.
- 1d21 can provide 4 binary digits (0 through 15 in base 2), and 1d7 provides 2 digits (0 through 3).
Solution: Roll 1d21 twice and 1d7 once. If the d21 lands higher than 16 or the d7 higher than 4, reroll. Subtract 1 from each roll so the range starts at 0. Convert to base 2. Append results to create one 10-digit binary value. If result > 993, toss it out and reroll.
There is a ~24% chance ($\frac{21-16}{21}$) of needing to reroll the d21 each time, a ~43% chance ($\frac{7-4}{7}$) for the d7, and a ~3% chance ($\frac{1024-994}{1024}$) of needing to reroll the final value.
*Ignoring rolls that are higher than the maximum rollable power of 2. I.e. if you had a d12, you would ignore rolls higher than 8 (23). This ensures an equal probability for each digit in the result.
Edit:
In light of Thomas Andrews' answer, multiple dice can be used to generate a higher $X$ value than one die alone. For a set of dice with number of sides $\{k1,k2,...,kn\}$ and rolls $\{r1,r2,...,rn\}$, the maximum $X$ value will be $k_1k_2k_3...k_n$ and a given roll value will be: $$r_1 + (r_2 - 1)k_1 + (r_3 - 1)k_1k_2 + \cdots + (r_n - 1)k_1k_2...k_{n-1}$$