Hi, I may post some DSA / interview questions I find interesting (even if you would be unlikely to see it in an interview) from some of the books I own / codeforces / leetcode etc.

This question comes from Elements of Programming Interviews in Java written by Lee, Aziz, and Prakash.

4.10 Generate Random Uniform Numbers

How would you implement a random number generator that generates a random integer i between a and b inclusive, given a random number generator that produces a zero or one with equal probability?

ALL values in range [a,b] inclusive should be equally likely.