func (f *Filter) Reset() {
	f.b.Reset()
}
Resets the filter.
package bloom
import (
	"github.com/pmylund/go-bitset"
	"encoding/binary"
	"fmt"
	"hash"
	"hash/fnv"
	"math"
)
type filter struct {
	m uint32
	k uint32
	h hash.Hash64
}
func (f *filter) bits(data []byte) []uint32 {
	f.h.Reset()
	f.h.Write(data)
	d := f.h.Sum(nil)
	a := binary.BigEndian.Uint32(d[4:8])
	b := binary.BigEndian.Uint32(d[0:4])
	is := make([]uint32, f.k)
	for i := uint32(0); i < f.k; i++ {
		is[i] = (a + b*i) % f.m
	}
	return is
}
func newFilter(m, k uint32) *filter {
	return &filter{
		m: m,
		k: k,
		h: fnv.New64(),
	}
}
func estimates(n uint32, p float64) (uint32, uint32) {
	nf := float64(n)
	log2 := math.Log(2)
	m := -1 * nf * math.Log(p) / math.Pow(log2, 2)
	k := math.Ceil(log2 * m / nf)
	words := m + 31>>5
	if words >= math.MaxInt32 {
		panic(fmt.Sprintf("A 32-bit bloom filter with n %d and p %f requires a 32-bit bitset with a slice of %f words, but slices cannot contain more than %d elements. Please use the equivalent 64-bit bloom filter, e.g. New64(), instead.", n, p, words, math.MaxInt32-1))
	} else if m > math.MaxUint32 {
		panic(fmt.Sprintf("A 32-bit bloom filter with n %d and p %f requires a 32-bit bitset with %d bits, but this number overflows an uint32. Please use the equivalent 64-bit bloom filter, e.g. New64(), instead.", n, p, m))
	}
	return uint32(m), uint32(k)
}
type Filter struct {
	*filter
	b *bitset.Bitset32
}
func (f *Filter) Test(data []byte) bool {
	for _, i := range f.bits(data) {
		if !f.b.Test(i) {
			return false
		}
	}
	return true
}
func (f *Filter) Add(data []byte) {
	for _, i := range f.bits(data) {
		f.b.Set(i)
	}
}