Calculators
Collision Entropy Calculator
Calculate collision entropy in bits and nats, matching-draw probability and effective outcome count from discrete outcome weights in your browser.
Enter one non-negative weight per outcome, separated by spaces, commas or semicolons. Weights are normalized automatically. Use 1–10000 values and at most 200000 characters. Nonzero weights must be between 1e-100 and 1e100; at least one must be positive. Calculation runs locally in your browser.
How collision entropy works
Collision entropy is Rényi entropy of order 2: H₂ = −log₂(Σpᵢ²). Enter one non-negative count, weight or probability per distinct outcome; weights are normalized automatically. The sum of squared probabilities is the chance that two independent draws with replacement produce the same outcome. Its reciprocal is the effective number of equally likely outcomes (inverse Simpson concentration). For weights 1, 1, 2, the collision probability is 0.375, entropy is about 1.41503749928 bits and effective outcome count is 2.66666666667. Equal weights across n outcomes give log₂(n) bits; a certain outcome gives zero. Nats use natural logarithms. Min-entropy is no greater than collision entropy, which is no greater than Shannon entropy for the same distribution. Zero weights contribute nothing. This describes the supplied discrete distribution and does not estimate an unknown random source. Enter 1–10000 weights separated by spaces, commas or semicolons, up to 200000 characters. Commas separate values, not thousands. Nonzero weights must be between 1e-100 and 1e100; at least one must be positive. Scaling and compensated sums reduce overflow and rounding error. Results display up to 12 significant digits. All processing stays in your browser.
Frequently Asked Questions
Everything you need to know about this tool, how it works, and privacy.
What is collision entropy?
It is −log₂ of the sum of squared normalized outcome probabilities, also called Rényi entropy of order 2.
What does collision probability mean?
It is the probability that two independent draws with replacement from the same distribution have matching outcomes. It is not the probability of any match among a larger group of draws.
Do weights need to sum to one?
No. Non-negative counts or weights are normalized automatically. At least one must be positive.
What is an example?
Weights 1, 1, 2 give probabilities 0.25, 0.25, 0.5. Their squared sum is 0.375, so collision entropy is about 1.415 bits.
What is the effective outcome count?
It is 1 / Σpᵢ², the number of equally likely outcomes with the same collision probability. It can be fractional.
How does it compare with Shannon and min-entropy?
For the same discrete distribution, min-entropy ≤ collision entropy ≤ Shannon entropy. All three agree for a uniform distribution.