chickadee » bloom-filter » desired-m

(desired-m P N [K]) => (fixnum fixnum number) procedure

Calculates a near-optimal number of bits of discrimination to meet the desired probability of false positives P, with the given population size N and number of hashes K. When the K parameter is missing optimum-k is used to calculate a value.

A multi-valued return of the calculated M, K, and P values. The calculated probability may be lower than the desired. The calculated M value will always be a fixnum.