Crate bloomcalc

Source
Expand description

§bloomcalc

bloomcalc provides a calculator for bloom filters.

§Status

Maintenance track. The library is considered stable and will be put into maintenance mode if unchanged for one year.

§Scope

This library provides the basics of a bloom filter with the bloomcalc command.

% target/debug/bloomcalc --prob 0.01
a bloom filter with false positive rate of 0.01 will work best with 6.643856189774724 keys

% target/debug/bloomcalc --card 1000 --prob 0.01
a bloom filter for 1000 items with false positive rate 0.01 will need 9585.058377367439 bits

% target/debug/bloomcalc --card 1000 --bits 10000
a bloom filter for 1000 items with 10000 bits will have a 0.008192549468178963 false positive rate

§Warts

None.

§Documentation

The latest documentation is always available at docs.rs.

Structs§

K
K is the number of keys to insert/hash.
M
M is the number of bits to use in the bloom filter.
N
N is the number of items expected to be inserted into the bloom filter.
P
P is the probability of false positives.

Traits§

Parameter
A Parameter is a typed wrapper around a f64.

Functions§

calc_keys_given_probability
Given the probability of false positive, compute the necessary number of keys.
calc_m_given_p_n
Given the probability of false positive and number of elements, compute the number of bits.
calc_p_given_n_m
Given the number of elements and number of bits, compute the probability of false positive.