What are the odds of a random number generated in given range being higher than given number?

I assume that you are asking what is the probability that a > b and a > c.

Line 4 of your code tells us that a will be scaled by a factor between 0.9 and 1.1.

Assuming that random.nextFloat() returns an even distribution, then there is a 17/20 chance that a > b because this is just the probability that the random float between 90 and 120 is in the range [93, 110].

Similarly there is a 4/20 chance that a > c

Leave a Comment