Birthday paradox

Compare the exact shared-birthday probability with reproducible random groups.

About this tool

The model assigns each person an independent birthday on one of 365 equally likely days. A group is a hit if at least two people share any day. It does not model leap days, seasonal birth rates or dependence between birthdays. Day indices 1–365 are model categories, not calendar dates.

Theory: for 0 ≤ n ≤ 365, the probability of no match is q = ∏j=0n−1(1 − j/365); the match probability is p = 1 − q. For n = 0 or 1, p = 0 exactly. At n = 23, p ≈ 50.73%. At n = 366, p = 1 by the pigeonhole principle. For n = 365, q remains positive even when floating-point arithmetic rounds p to 1. The display marks rounded 100% values with ≈ and retains q in the theory details.

Monte Carlo: enter 0–366 people, 100–20,000 groups and a 32-bit seed (0–4,294,967,295), then Start. The sample estimate is the number of groups with a match divided by the number completed. The seed reproduces the same sequence; Pause and Resume retain its position. Every birthday in a group is drawn, including those after its first match. The last-group tab shows only days occupied by two or more people, together with the total number of people and occupied days. Examples change group size without changing the seed.

Uncertainty: only a completed run displays the two-sided nominal 95% Wilson score interval. With M groups, k hits, p̂ = k/M and z = 1.959963984540054, its center is (p̂ + z²/(2M))/(1 + z²/M), and its half-length is z√(p̂(1−p̂)/M + z²/(4M²))/(1 + z²/M). This is an approximate frequentist interval, not a promise that every run contains the theoretical value. It is calculated for the number of groups chosen before sampling, not as a simultaneous confidence band while watching or pausing. For the model-deterministic cases n = 0, 1 and 366, the known exact value replaces Wilson uncertainty.

Reading and controls: ○ marks theory, × the sample estimate; the final orange bar is the Wilson interval. A sample estimate beside the theoretical value is normal random variation, not automatically an error. The uncertainty describes repeated ideal independent sampling; a reproducible pseudorandom stream is not a proof of statistical independence. Editing any parameter clears the run, including a finished result. Repeat uses the same seed and therefore repeats the result. Reset keeps inputs, navigation retains valid inputs, and returning does not start sampling.

Sources: MIT 6.041/6.431, Recitation 4 (2010), problem 1; NIST/SEMATECH e-Handbook §7.2.4.1, Wilson confidence interval.