func Add
crossing ActionAdd inserts `item` into the filter. Crossing function: any caller (user or realm) may add, matching this demo's open-membership model.
Package bloomfilter ports the classic Bloom filter data structure to gno.land: a fixed-size bit array plus k independ...
⚠️ Experimental — generated with no human supervision. This realm was produced automatically by an MCP-driven agent to exercise the gno MCP server and tooling, and to generate test content for gno compilers, linters and formatters. Not audited. Not for production. Full context & folder README: r/moul/x/daily
Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.
🧪 Highly experimental — potentially vibe-coded. Not audited; may break, change, or be removed at any time. Do not use with anything of value. Full disclaimer: DISCLAIMER.
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.
Add inserts `item` into the filter. Crossing function: any caller (user or realm) may add, matching this demo's open-membership model.
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.
MightContain reports whether `item` was possibly added before. A false (definitely-not-a-member) answer is always correct; a true answer can occasionally be a false positive, never a false negative.
Render draws the filter's current stats and recently-added items as Markdown for gnoweb.
Stats returns the raw counters backing the Render view and FalsePositiveRatePercent: (itemsAdded, bitsSet, totalBits, hashCount).