Collision Odds for Random 32-bit Document IDs in Google Docs

Last updated: November 29, 2026

Quick Overview

Google Docs assigns each new comment thread a uniformly random 32-bit ID. Estimate the probability of at least one collision among 100,000 IDs, and find how many IDs give a 50% collision chance.

Google
Statistics & Math
Software Engineer
Google
November 29, 2026
Software Engineer
Phone Screen
Statistics & Math
Medium

0

0

0 solved


Google Docs assigns each new comment thread a uniformly random 32-bit ID. Estimate the probability of at least one collision among 100,000 IDs, and find how many IDs give a 50% collision chance.

This birthday-problem variant shows up in Google SWE phone screens when an interviewer wants to see whether you can sanity check an ID scheme before it ships. They check that you can derive the approximation, plug in numbers quickly, and translate the result into an engineering decision such as moving to 64 or 128 bits.

What the Interviewer Expects
  • Model IDs as independent uniform draws from N = 2^32 values
  • Derive P(no collision) as a product and approximate it with an exponential
  • Compute about 69% collision probability for 100,000 IDs
  • Find the 50% threshold near 1.18 sqrt(N), about 77,000
  • Recommend a wider ID or collision check
Key Topics to Cover
birthday problem
union bound
exponential approximation
hash collisions
ID design
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 many bits do you need so that 1 billion IDs collide with probability below one in a million?
  • What changes if IDs are scoped per document rather than global?
  • How would you detect and handle a collision if it does occur?
  • Why is the expected number of colliding pairs a useful upper bound?
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

Assume IDs are drawn independently and uniformly from N=232≈4.29×109N = 2^{32} \approx 4.29 \times 10^9 values, and that the space is global (all IDs must be unique). We want P(at least one collision)P(\text{at least one collision}) fo...

Approach

Compute the complement. The kk-th ID avoids all previous ones with probability 1−(k−1)/N1 - (k-1)/N, so


Submit Your Answer
Markdown supported