Simulate probability p

Using only a fair coin, how do you simulate an event of probability p∈(0,1)p \in (0,1)?

Show hints (2)+
  1. Coin flips generate the bits of a uniform number.
  2. Compare those bits to pp's binary digits.

Answer

Reveal answer →

Compare coin-flip bits to the binary expansion of p

Create a free account to see the full worked solution and track your progress.

Interview format: Market Maker, Betting Game Rounds

Related questions