Jane Street–styleTraderAssistant TraderQuestion #266

How would you simulate the outcome of a six-sided die using only a fair coin?

Free worked solution · Quant Blueprint

Flip three coins to form a uniform integer from zero to seven; accept zero through five and return that integer plus one, otherwise repeat.

  1. Map tails to zero and heads to one. Three independent flips create eight equally likely binary strings.
  2. Reject 110 and 111. Map the other six strings to die faces one through six.
  3. Conditional on acceptance each retained string has probability 1/6. Repeating the same independent experiment preserves that uniform distribution.
  4. Each block succeeds with probability 6/8 = 3/4. The mean number of blocks is 4/3, so this algorithm uses four coin flips on average.

Common mistake

Taking the integer modulo six biases faces one and two because eight is not divisible by six.

Follow-up

No fixed finite number k of fair flips can generate exact sixths without rejection: each outcome probability would be an integer multiple of 1/2ᵏ, and six does not divide 2ᵏ. Four flips is the mean for this algorithm, not a claim of optimality.

Original educational explanation for this practice question. Reviewed . Firm-style practice; the label describes the collection’s preparation context.

Practice the Reasoning Behind the Answer

Bring your target roles and interview timeline to a free quant consult. Discuss your preparation priorities and how Quant Blueprint’s lessons, practice and mock interviews can help.

Book a Free Quant Consult

Your goals · your preparation · your next steps