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?

I don't think any of the existing answers explicitly state why the answer is 1 in 20 even if the friend is not equally likely to guess all 20 numbers (they aren't - humans are not good random number generators, and the friend might not even be trying to guess randomly).
For each possible roll $i$, let $p_i$ be the probability of your friend guessing $i$. We know that these probabilities must sum to 1:
$$\sum_{i=1}^{20}p_i = 1$$
Then the probability of the friend guessing correctly is:
$$
\sum_{i=1}^{20} P(\text{friend guesses } i)P(\text{roll }i) = \sum_{i=1}^{20}p_i \frac{1}{20} = \frac{1}{20}\sum_{i=1}^{20}p_i = \frac{1}{20}
$$
