Birthday-Bound Collision Probability

Calculate the standard birthday collision approximation for independent uniform samples from a finite outcome space.

Description

Independent uniform samples can collide even when the outcome space is much larger than the sample count.

Independent uniform samples can collide even when the outcome space is much larger than the sample count. The birthday approximation estimates the chance of at least one repeated outcome, rather than the chance of matching one chosen target.1

Calculate the standard birthday collision approximation for independent uniform samples from a finite outcome space.

When to use Birthday-Bound Collision Probability

Use this tool to calculate the standard birthday collision approximation for independent uniform samples from a finite outcome space.

Choose the text, counts, explicit reference time or format parameters requested by this tool. Follow the stated byte, epoch-time and randomness assumptions.

How to use Birthday-Bound Collision Probability and understand its results

  1. Choose the text, counts, explicit reference time or format parameters requested by this tool. Follow the stated byte, epoch-time and randomness assumptions.
  2. Enter spaceSize, sampleCount using the field table and calculation rules, then run the tool.
  3. Read probability. The explanation below defines the units, signs, ordering and any flags or placeholder values.
  4. If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
Input fieldMeaningValue type; see rules belowRequirement
spaceSizeOutcome space sizeinteger; minimum: 1; maximum: 9007199254740991Required
sampleCountSample countinteger; minimum: 0; maximum: 9007199254740991Required

Enter a positive safe-integer outcome-space size and a nonnegative safe-integer sample count. Fewer than two samples returns 0; more samples than outcomes returns 1 by the pigeonhole principle. Otherwise the tool evaluates the standard exponential approximation with expm1 to retain accuracy for small probabilities.

probability ≈ 1 − exp[−sampleCount(sampleCount−1)/(2×spaceSize)]

Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.

Output fieldMeaningValue type
probabilityApproximate collision probabilitynumber; minimum: 0; maximum: 1
json
{
  "input": {
    "spaceSize": 365,
    "sampleCount": 23
  },
  "output": {
    "probability": 0.5000017521827106
  }
}

Limitations and assumptions

This is an approximation rather than the exact finite product, especially for small spaces or dense sampling. Independence and uniformity are assumptions; it does not inspect generated tokens or measure a real generator. Counts are safe integers, so huge hash spaces cannot be entered directly.

Numeric inputs must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors.

Alternative or Complementary methods

Use UUID v4 Fixed Randomness Bits Lookup: Report the 122 available random bits of a UUIDv4 after validating its canonical version and variant syntax. For a complementary task, use Keyspace Size Calculator: Return the exact keyspace size for independent positions chosen from a fixed-size alphabet, with bounded output materialization.

References

  1. Birthday-Bound Collision Probability — tool.io

Similar or alternative tools

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies