Given two different ranges, probability of a number in one range being greater than the other

It has been a long time since I last studied probability and statistics but I am trying to solve a tricky (for me) problem.

If I have any two number ranges, what is the calculation for the probability of a random value in one range being higher than the other?

Simple example...

Range 1: 10-19

Range 2: 20-39

Result: 0% probability that a number in Range 1 is greater than Range 2.

Trickier example...

Range 1: 10-20

Range 2: 15-24

What is the probability that a random value in Range 1 is greater than a random value in Range 2?

-

Now we are dealing with ordered pairs of numbers, call Range 1 $X$ and Range 2 $Y$. We want $P(X>Y)$. Now the good pairs are $$(16,15),\ (17,15),\ .., (20,15);\ (17,16),\ .. (20,16); ...; (20,19).$$ We can count these for example according to the possible $Y$'s: the minimal possible $Y$ such that $X>Y$ is $Y=15$, then $X$ can be $16..20$, that is $5$ possibilities. If $Y=16$, we have $4$ possibilities, and so on. So it is $5+ 4+ 3+ 2+ 1=15$ possibilities altogether.
And the number of all possible pairs is now $11\cdot 10$.