Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

bloomfilter/v0 package

Overview

Package bloomfilter ports the classic Bloom filter data structure to gno.land: a fixed-size bit array plus k independent hash functions that let you test set membership with zero false negatives and a small, bounded false-positive rate — without ever storing the actual items.

Membership is checked via double hashing (Kirsch–Mitzenmacher): two base hashes h1, h2 are combined as h1 + i*h2 to derive k bit positions per item, avoiding the cost of k independent hash functions.

Add is a crossing function per the gno 0.9 interrealm convention (it takes `cur realm` as its first parameter); MightContain and Stats are read-only.

Function

FalsePositiveRatePercent

func FalsePositiveRatePercent() float64

FalsePositiveRatePercent estimates the current false-positive rate, in percent, as (bitsSet/m)^k — the standard Bloom filter approximation once bits are randomly distributed. Computed with plain integer/float math to avoid depending on math.Exp/Pow availability.

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/moul/x/daily/bloomfilter/v0.FalsePositiveRatePercent()"

Result