Given a distribution $P$, two values $a$ and $b$, $x=0$, and the following process:
- Draw a number $r$ from $P$ and add it to $x$, this is $x = x+r$.
- Keep doing this until $x$ is higher than $a$.
- Check if the final value of $x$ falls in the range $R=(a, b)$
Which is the probability of $x \in R$?
Phrasing this is a more mathematical way. Define $n(a)$ as
$n(a) = \min \{ n | r_1 + r_2 + ... + r_n > t \}$
where $r_i \sim P$. Then define the sum $s(a)$.
$s(a) = \sum_{i=1}^{n(a)} r_i$.
$n(a)$ is the stopping time (how many times are we going to draw values from $P$ before stopping), and $s(a)$ is the value that we will have after the process.
Then the question is, which is $\mathbb{P}(s(a) \leq b)$?
For more clarity, here you have two examples of the process. Each jump represents the addition of a random value $r \sim P$ to $x$. In this example, the final value falls in the range $(a, b)$.
But in this example, the final value of $x$ falls out of the range $(a, b)$.
Notice that
- $b$ is not used to generate the value $x$. It's only used to check if the final value $x$ falls in the range $(a, b)$.
- The bigger the value of $b$ the higher the probability of $x \in (a, b)$. In fact, if $b=\infty$ then we have a probability of $1$.
- We can use any distribution $P$, but maybe there are distributions where the process never ends. For example, if the distribution has a domain in the negative reals and $a > 0$ the process will never end.