Is there a 1 in 20 or 1 in 400 chance of guessing the outcome of a d20 roll before it happens? My friends are in a bit of an argument over Dungeons & Dragons.
My player managed to guess the outcome of a D20 roll before it happened, and my friend said that his chance of guessing the number was 1 in 20. Another friend argues that his chance of guessing the roll is 1 in 400 because the probability of him randomly guessing a number and then rolling it were both 1 in 20 so the compound probability is 1 in 400. Which of these probabilities is a better characterization of our situation, and what were really his chances?

Yes for any specific number $1,\ldots,20$ the probability that your friend selects that number and the dice rolls it is 1/400, but you must marginalize over all possible options:
If $X\sim \text{Unif}(1,\ldots,20)$, $Y\sim \text{Unif}(1,\ldots,20)$, Let $Z=X-Y$ then
$$
\begin{align*}
\text{P}(\text{predict roll}) &= \text{P}(Z=0)\\
&= \sum_{y=1}^{20} P(X=0+y)P(Y=y) &&\text{convolution formula for sums of random variables}\\
&= \sum_{y=1}^{20} \tfrac{1}{20}\tfrac{1}{20}\\
&= \tfrac{1}{20}
\end{align*}
$$
And by simulation
tmp <- data.frame(x=sample(1:20, size=100000, replace=TRUE ), y=sample(1:20, size=100000, replace=TRUE ))
> mean(tmp$x == tmp$y)
[1] 0.0497

