Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BloomFilter ¶
type BloomFilter struct { Capacity int // n FalsePositiveRate int // p NumHashes int // k BitSize int64 // m // contains filtered or unexported fields }
func NewBloomFilter ¶
func NewBloomFilter(capacity, probability int) *BloomFilter
Returns a new Bloom filter. Parameters are the expected number of elements in the set and the desired false positive probability. Optimal size and number of hashes are calculated based on these numbers.
p = false positive rate of the form 1/p, powers of two preferred optimal number of hashes k = (m/n)ln(2)
func (*BloomFilter) Add ¶
func (set *BloomFilter) Add(input []byte)
Adds a piece of arbitrary data to the set
func (*BloomFilter) Check ¶
func (set *BloomFilter) Check(input []byte) bool
Checks the set for a piece of arbitrary data
Click to show internal directories.
Click to hide internal directories.