If every time a condition is evaluated, there is exactly an
x chance of it succeeding (
RAND() < x), is there any way to simulate this formula
n times, in order to get the number of successes?
I'm not asking about an average, although, if the formula worked as expected, higher values of
nwould have results getting closer to the average.
Bit of background info:
I'm addressing this from a programming perspective, so the simple (yet expensive) solution would be to iteration
i = 0 to n, evaluate
RAND() < x, and count the number of successes.
However, I'll be dealing with quite varied values of
n, from very low, to quite high, and performance will be quite critical. Evaluating
RAND() 1,000,000 times just to simulate this is quite unideal.