Uniform integer from a fair coin
You can flip a fair coin as often as you like and nothing else.
Return a uniform integer in . Prove uniformity, give the expected number of flips, and explain why the naive "gather bits, take mod " is biased.
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.