Fair Fifty Fifty Experiment Split From a Biased Random Bit

Last updated: November 29, 2026

Quick Overview

An experiment assignment service only has access to a random bit that is 1 with some unknown probability p. How can you produce an exactly fair 50/50 treatment assignment, and how many bits does it consume on average?

Meta
Statistics & Math
Software Engineer
Meta
November 29, 2026
Software Engineer
Technical Screen
Statistics & Math
Medium

0

0

0 solved


An experiment assignment service only has access to a random bit that is 1 with some unknown probability p. How can you produce an exactly fair 50/50 treatment assignment, and how many bits does it consume on average?

Meta runs thousands of concurrent experiments, and assignment must be unbiased even if an entropy source is not. This von Neumann extractor question checks that a candidate can construct a symmetric event from a biased source and compute the expected cost with a geometric argument.

What the Interviewer Expects
  • Pair the bits: 10 means treatment, 01 means control, otherwise discard
  • Show $P(10) = P(01) = p(1-p)$ so the output is fair
  • Compute expected bits $1/(p(1-p))$
  • Evaluate for p = 0.7 (about 4.76 bits)
  • Mention more efficient extractors and why production uses hashing
Key Topics to Cover
Von Neumann extractor
Geometric distribution
Symmetry
Randomization
How to Approach This
  1. Define your hypotheses (H0 and H1) clearly before performing any test.
  2. Calculate required sample size BEFORE running an experiment, using power analysis.
  3. Remember the Central Limit Theorem: sample means become approximately normal with large n.
  4. Watch for Simpson's paradox. Always segment data by key dimensions.
  5. Distinguish between statistical significance and practical significance.
Possible Follow-up Questions
  • How could you reuse discarded pairs to waste fewer bits?
  • What if consecutive bits are correlated?
  • How would you test that the resulting split is fair?
  • Why do real systems assign by hashing user IDs instead?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Browse Statistics Questions
Sample Answer
Clarify

Bits B1,B2,…B_1, B_2, \dots are iid with P(B=1)=pP(B = 1) = p, 0<p<10 < p < 1, unknown. We need an output that is exactly 50/50 and independent of pp, and its expected cost in bits....

Approach

Look for two events with equal probability no matter what pp is. For a pair of bits, the outcomes 10 and 01 each have probability p(1−p)p(1-p). So emit treatment on 10, control on 01, and retry on 00 or ...


Submit Your Answer
Markdown supported