How Long Must Transaction Reference IDs Be to Avoid Collisions
Last updated: November 29, 2026
Quick Overview
PayPal generates random transaction reference IDs from a 32-character alphabet. With 40 million new transactions per day, estimate the expected number of collisions per day for 8-character IDs, and find the shortest length that keeps the probability of any collision in a year below one in a million.
PayPal
November 29, 20260
0
0 solved
PayPal generates random transaction reference IDs from a 32-character alphabet. With 40 million new transactions per day, estimate the expected number of collisions per day for 8-character IDs, and find the shortest length that keeps the probability of any collision in a year below one in a million.
Short, human-readable reference IDs appear on PayPal receipts and in support conversations, and collisions cause misrouted lookups. This birthday-problem question checks the $n^2/2N$ approximation, unit handling with large exponents, and the engineering conclusion that uniqueness should still be enforced.
What the Interviewer Expects
- Apply the birthday approximation for expected collisions
- Compute ID space size correctly as 32^L = 2^(5L)
- Scale from a day to a year correctly (n grows, collisions grow as n squared)
- Solve for the minimum length
- Recommend uniqueness constraints and retry, not just longer IDs
Key Topics to Cover
How to Approach This
- Define your hypotheses (H0 and H1) clearly before performing any test.
- Calculate required sample size BEFORE running an experiment, using power analysis.
- Remember the Central Limit Theorem: sample means become approximately normal with large n.
- Watch for Simpson's paradox. Always segment data by key dimensions.
- Distinguish between statistical significance and practical significance.
Possible Follow-up Questions
- Does it matter whether collisions must be unique per day or forever?
- How would a timestamp prefix change the math?
- Why might you avoid characters like 0, O, 1 and I, and how does that change N?
- What other risk do short random IDs create (guessability)?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Browse Statistics QuestionsSample Answer
Clarify
IDs are uniformly random strings of length over 32 symbols, so the space is . Collisions are counted among all IDs that must be unique together; first per day, then over a year ...
Approach
Expected number of colliding pairs among random draws from values is . When this is small, $P(\text{any collision}) \approx 1 - e^{-n^2/2N} \approx \frac...