The following is an exercise from Rice's Mathematical Statistics and Data Analysis:
This problem shows one way to generate discrete random variables from a uniform random number generator. Suppose that F is the cdf of an integer-valued random variable; let U be uniform on [0, 1]. Define a random variable Y = k if F(k − 1) < U ≤ F(k). Show that Y has cdf F.
I know how to prove this (by writing F's cdf as a sum of cdf of uniform distribution, which then eventually cancels / simplifies nicely to give F_Y(x) = F(x)) but I'm having trouble developing an intuition as to what this method means and how it works. I am not looking for a solution to the exercise / a proof. I want to understand why this method works at a conceptual level.
I'm not sure what this method is called so I couldn't search for other resources on this.