[RPG] How to calculate the distribution of “roll 4d6, keep rerolling 1s and 2s, and drop the lowest die” in AnyDice

ability-scoresanydicestatistics

I am joining a D&D group. To generate each ability score, the DM has us roll 4d6, reroll any 1 or 2, and then drop the lowest die. If the reroll is a 1 or 2, then reroll again and again until the result is 3 or higher.

I am curious about the distribution, and wonder if AnyDice could do it. How can I calculate the distribution of this ability score generation method in AnyDice?

Best Answer

Assuming you reroll each d6 until it doesn't show a 1 or 2 anymore, the easiest way to model that constraint is as a custom die, d{3..6}. This represents a uniform die that can only roll the values 3, 4, 5, and 6. (Side note: at the table, you can substitute d4+2 and get the same result, if you want to roll once without rerolls.)

To keep only a subset of dice, use the functions highest or lowest.

Thus, we can show "4d6, reroll any 1s and 2s, then drop the lowest die" as:

output [highest 3 of 4d{3..6}]