Artificial intelligent assistant

How to cheat at Dungeons and Dragons Character Generation? When creating a new character in Dungeons and Dragons, one will typically roll three dice to generate a score for an attribute such as Strength, Agility, Constitution, etc. The probability for any particular outcome for the rolls, 3 through 18, follows a certain distribution. Let us suppose that instead of simply taking the result of the roll, that we decide to cheat, and roll three times, taking the best result as our attribute score. How do we calculate the new probability distribution, and the resulting expectation value? How would we extend this to a generic scenario where we know the base probability distribution, and want to reroll n number of times?

It seems to me that in general you are after the distribution of $M:=\max(X_1,\dots,X_n)$ where the $X_i$ are iid random variables (correct me if I am wrong).

The CDF of $M$ can easily be expressed in the CDF of the $X_i$:

$$F_M(x)=P(X_1\leq x,\dots,X_n\leq x)=F(x)^n$$

In the special case you mention we find: $$p_k=P(M=k)=F^3(k)-F^3(k-1)$$ for $k=3,\dots,18$ so that: $$\mathbb EM=\sum_{k=3}^{18} k[F^3(k)-F^3(k-1)]$$

Alternatively you could use:$$\mathbb{E}M=\sum_{k=0}^{17}P\left\\{ M>k\right\\} =\sum_{k=0}^{17}1-F^{3}\left(k\right)$$

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy c4167723ebca8aaf8ae33a74778db8a1