The number of ways to choose 4 items out of a set of 12 items is 495.
The number of results you can get by rolling an eight-sided die 3 times is 512.
Therefore, theoretically, if you're trying to choose 4 out of 12 items, you can roll an eight-sided die three times, and 96.6796875% of the time you won't need to re-roll.
However, it's not particularly obvious how to map 495 of the 512 results onto choices of 4 items. Yes, you could have a massive look-up table with 495 rows, but that's a bit hard to carry around in your pocket.
So, I've come up with the following little "rule"... unfortunately, it's much more complex than I had hoped. Can anyone do better?
Let's call the 12 items you're trying to choose ABCDEFGHIJKL. Split them into two halves, ABCDEF and GHIJKL. Generally, we're going to have the first roll of the die tell us how many to choose from each half, with the other rolls telling us which ones.
Now, we'll roll the die three times, let's say the values are X, Y, and Z. Then:
If X == 1, then we're going to choose three items from ABCDEF, and one item from GHI.
If X == 2, then we're going to choose three items from ABCDEF, and one item from JKL.
If X == 3, then we're going to choose three items from GHIJKL, and one item from ABC.
If X == 4, then we're going to choose three items from GHIJKL, and one item from DEF.
If X == 5 through 8, then we'll either choose two items from both halves, or all items from the same half.
For the case of X == 1 through 4, we need to choose 3 out of a group of 6, and 1 out of a group of 3. Let's call the group of six MNOPQR, and the group of three STU.
If Y == 1 through 6, then we'll choose MNO based on the bit representation of Y. To wit:
Y == 1, choose --O.
Y == 2, choose -N-.
Y == 3, choose -NO.
Y == 4, choose M--.
Y == 5, choose M-O.
Y == 6, choose MN-.
After that, we'll have three choices of the group PQR (either 1 or 2 items, based on how many of MNO were chosen), and three choices of the group STU. We'll use the roll Z to put among those 9 choices -- simply put Z in base three, and choose among PQR and STU appropriately (using the mapping 012).
Since that's 8 outcomes to choose among 9 results, one will be leftover, namely, P and S. So let's use those for the case Y == 7:
Y == 7 and Z == 1: --O -QR S--
Y == 7 and Z == 2: -N- -QR S--
Y == 7 and Z == 3: -NO P-- S--
Y == 7 and Z == 4: M-- -QR S--
Y == 7 and Z == 5: M-O P-- S--
Y == 7 and Z == 6: MN- P-- S--
Y == 7 and Z == 7: MNO --- S--
Y == 7 and Z == 8: --- PQR S--
This leaves four cases left, and we'll map them to when Y == 8:
Y == 8 and Z == 1: MNO --- -T-
Y == 8 and Z == 2: MNO --- --U
Y == 8 and Z == 3: --- PQR -T-
Y == 8 and Z == 4: --- PQR --U
In the case where Y == 8 and Z > 4, reroll.
Now, when X is 5 through 8, we'll be choosing two items from each half (or four from the same half). It turns out there are 15 ways of choosing two items from a group of 6 (or four from a group of 6), and conveniently 15 just a little bit less then twice 8. I haven't found a good way to map numbers from 1 to 15 onto the 15 ways, so here's one that's as good as any:
MN---- 1
-NO--- 2
--OP-- 3
---PQ- 4
----QR 5
M--P-- 6
-N--Q- 7
--O--R 8
M-O--- 9
-N-P-- 10
--O-Q- 11
---P-R 12
M---Q- 13
-N---R 14
M----R 15
So, now all we need are two numbers from 1 to 15. That's pretty easy, since we have the rolls Y and Z, which range from 1 to 8. Now use X to distinguish:
If X == 5, take Y and Z exactly.
If X == 6, add 8 to Z.
If X == 7, add 8 to Y.
If X == 8, add 8 to both Y and Z.
Now Y and Z are all in the range 1-16. So:
If both Y and Z are in the range 1-15, use Y to choose two items from ABCDEF and Z to choose two items from GHIJKL.
If Z == 16, then use Y to identify two items from ABCDEF; then choose the other four.
If Y == 16, then use Z to identify two items from GHIJKL; then choose the other four.
Finally, if both Y and Z are 16 (you rolled 8, 8, 8), then reroll. |