I am trying to write a program dealing with random number generation, but I figured this would be the best forum to ask this. My program will, given each of the March Madness teams' probabilities of winning at each round, generate a partially random bracket based on those numbers. My program uses FiveThiryEight's round-by-round numbers. My algorithm for determining a winner is to take each team's chance of winning that round (doesn't add to 1 in later rounds by design, since the odds are all from the first round looking ahead), multiply each teams' odds by a uniformly distributed number between 0 and 1, and advancing the team with the higher score by this method to the next round.
However, this is creating some unexpected behavior. For example: a team with a 40% chance of winning round 2 against a team with a 20% chance of winning the round will win 3/4 of the time, instead of 2/3 as would be expected. A team with a 60% chance against a team with a 40% chance in round 1 will win 2/3 of the time instead of 3/5. These results are the product of a small Matlab script I wrote to test the algorithm. Where is the problem in the algorithm, and how can I fix it?
If $U$ and $V$ are independent random numbers in $[0,1]$ with uniform distribution, and $0 < a < b$, then $P(a U > bV) = a/(2b)$ and $P(a U < bV) = 1 - a/(2b) = (2b - a)/(2b)$.
This can be seen from a diagram: $P(aU > bV)$ is the area of the triangle with vertices $(0,0)$, $(1,0)$ and $(1,a/b)$. So the ratio of probabilities is not $a$ to $b$ but $a$ to $2b-a$. If you want team A to beat team B with probability $p$ (where $p \le 1/2$), you want to take $a = 2 p b $.
EDIT: Here is the diagram. The shaded region consists of points $(u,v)$ with $0 \le u \le 1$, $0 \le v \le 1$ and $au > bv$.