I've been working on coding recently, and when I needed a non-specific probability (so that an action would occasionally happen) I started using a certain way of creating a probability, and I wanted to know if I could determine the exact probability. The way I did this was somewhat as follows:
A random whole number, $a,$ is picked from a set $\lbrace 1,\dots,x\rbrace.$ Another random whole number, $b,$ is picked from a set $\lbrace 1,\dots,y\rbrace.$ If $y$ is greater than $x,$ what is the probability that $a$ will be greater than $b?$
(also, I apologize if this isn't explained/formatted very well; I'm new to this website and I don't know much about typing/explaining complicated math problems)

Since $y\gt x,$ the probability that $a$ is greater than $b$ is equal to
\begin{align} \sum_{a=1}^x \Big(\frac{1}{x} \sum_{b=1}^{\min(a-1,y)} \frac{1}{y}\Big)&=\sum_{a=1}^x \Big(\frac{1}{x} \frac{\min(a-1,y)}{y}\Big) \\&=\sum_{a=1}^x \Big(\frac{1}{x} \frac{a-1}{y}\Big) \\&=\frac1{xy}\sum_{a=1}^x(a-1) \\&=\frac1{xy}\frac{(x-1)x}{2} \\&=\frac{x-1}{2y}. \end{align}