Use this for sampling without replacement
Use a hypergeometric model when a finite population has N items, exactly K are successes, and n distinct items are sampled without replacement. It fits card draws or lot inspection when the population composition is treated as known. Independent repeated trials belong in the binomial calculator instead.
Exact, cumulative and range formulas
P(X=x) = C(K,x)C(N−K,n−x)/C(N,n). At most, at least and the inclusive entered range sum feasible x values. Mean = nK/N. Variance = n(K/N)(1−K/N)(N−n)/(N−1). The implementation uses log combinations, support limits and compensated summation.
Three independent checks
For N=48, K=12, n=10 and x=4, P(X=4)=0.147408488, P(X≥4)=0.202292480 and P(2≤X≤4)=0.733532714. With n=15, P(X≥4)=0.561856611. For N=50, K=5, n=10 and x=1, P(X=1)=0.431337197, P(X≥1)=0.689437218 and P(1≤X≤2)=0.641176915. For N=K=n=x=0, the empty sample has probability 1, mean 0 and standard deviation 0.
Compare a sample-size decision
The optional scenario changes only n and reports the change in P(X≥x) and expected successes. It helps quantify how a larger sample changes detection probability under the same known lot composition; it does not choose an acceptance threshold or certify a quality-control plan.
Sources and calculation scope
N, K, n and x are integers; K and n cannot exceed N. N is capped at 1,000 for responsive browser use. Official formula and moments: NIST Hypergeometric Distribution reference.