See this SO thread: Calculating which item is next in a percentage distribution.
To summarize,
you calculate
max ((rand1 * 10), (rand2 * 20), (rand3 * 30), (rand4 * 40))
for four random numbers in a range (say 1-100
).
If the max
is
rand1 * 10, you choose 'A'
rand2 * 20, you choose 'B'
rand3 * 30, you choose 'C'
rand4 * 40, you choose 'D'
What is the expected distribution of choosing A, B, C and D?
How to derive it mathematically?
(Using some C code, the percentages come out to be 1, 10, 31 and 56 respectively)