Let $w = (w_1,w_2,\dots)$ be an infinite sequence of nonnegative numbers that sums to unity.

Consider the function

$$f_w(u) = \sum_{j=1}^{\infty}\mathbf{I}(u < w_j).$$

- Prove that $f_w$ is a probability density in $u > 0$.
- Describe a simulation technique for generating a random variable $U \sim f_w(u)$.