DevTools Logo

Bloom & Cuckoo Filter Simulator

Bloom & Cuckoo Filter Simulator

Explore deterministic probabilistic membership filters in your browser

Words and parameters

About

Compare theoretical and measured Bloom filter false-positive rates while inspecting bits, fingerprints, kick chains, and insertion failures. All computation stays in your browser.

Examples

Inserted values always hit

Input
simulateBloomCuckooFilter(["apple"], ["apple", "durian"], { bitCount: 256, hashCount: 3, seed: 11 })
Output
apple -> { maybeIn: true, inserted: true }

Bloom filters have no false negatives, so every inserted member reports maybe-present.

Small m raises the FP rate

Input
theoretical at bitCount 16 vs 1024 (10 words, k = 3)
Output
rate(16) > rate(1024)

The (1 - e^(-kn/m))^k formula grows as bits per item shrink.

About this tool

Bloom Cuckoo Filter Simulator compares probabilistic membership with simulateBloomCuckooFilter(words, queries, options) (alias runFilterSimulation): a Bloom bit array with double-hashed positions plus a cuckoo table with fingerprint buckets, kick chains, and bounded failures. Results include bloomBits, bloomQueries ({ value, maybeIn, inserted }), theoretical and measured false-positive rates, and the cuckoo buckets/inserted/failed/kickChain.

Hashing is a seeded FNV-1a variant (hashString, unsigned and browser-reproducible): bloomPositions uses h1 + i*h2 mod m with an odd h2, cuckoo fingerprints mask to fingerprintBits, and index pairs XOR a fingerprint-derived alternate bucket. The theoretical rate is (1 - e^(-k*n/m))^k over distinct n.

Cuckoo insertion is transactional: both candidate buckets are tried first, then up to maxKicks evictions are attempted, and on failure the buckets roll back to a pre-kick snapshot while the value lands in failed. Same seed and options always yield identical kick chains.

How to use this tool

  1. Insert the word list

    Add the true member set — every inserted value must query back as maybe-present.

  2. Query members plus absentees

    Mix inserted words with never-added probes so measured false positives have a denominator.

  3. Tune m, k, and cuckoo shape

    Grow bitCount to lower the FP rate, adjust hashCount, and size bucketCount/bucketSize/fingerprintBits/maxKicks for the cuckoo side.

  4. Read rates and kick chains

    Compare theoretical versus measured FP rates, then inspect failed and kickChain for eviction pressure.

Use cases

Sizing a membership filter

Preview how bitCount and hashCount trade memory against false positives before shipping.

Demonstrating no false negatives

Show students that inserted items always test positive while absentees only sometimes do.

Stress-testing cuckoo eviction

Force tiny bucketCount/bucketSize tables to watch kick chains, rollbacks, and failed lists.

Common mistakes

Mistake:Reading maybeIn: true as definitely present.

Fix:A Bloom positive on a never-inserted value is a false positive — only maybeIn: false is conclusive absence.

Mistake:Expecting failed cuckoo inserts to leave partial state.

Fix:Failed kicks roll back to the pre-insert snapshot, so buckets are unchanged and the value appears only in failed.

Mistake:Comparing runs across different seeds.

Fix:Positions, fingerprints, and kick victims all derive from seed — keep it fixed for reproducible comparisons.

Frequently asked questions

What does this tool do?

It simulates Bloom plus cuckoo membership with simulateBloomCuckooFilter (alias runFilterSimulation): seeded FNV-1a hashing, double-hashed Bloom positions, fingerprint cuckoo buckets with kick chains, and theoretical (1 - e^(-kn/m))^k versus measured false-positive rates.

Can an inserted item ever test negative?

No. Bloom filters have no false negatives — every inserted word reports maybeIn true. Only never-inserted probes can surprise you with a false positive.

Is my word list uploaded or stored?

No. Hashing, bit setting, eviction kicks, and rate math all run locally in your browser.

What happens when a cuckoo insert fails?

Buckets roll back to the pre-kick snapshot, so they are unchanged; the value lands in failed with its kickChain preserved for inspection.

References & standards

.env Secret Safety Linter

Validate .env syntax and spot likely leaked credentials or placeholder secrets.

.htaccess Generator

Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth

2D Fluid Dynamics & Particle Physics Sandbox

A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.

AI Function Calling Schema Generator

Generate function calling JSON schemas from TypeScript interfaces

Algorithm Arena & Data Structure Visualizer

Interactive arena for algorithms and data structures: eight sorting algorithms racing on one seeded input, six pathfinding algorithms walking generated mazes, and BST, AVL, Red-Black, B-tree, heap and trie operations replayed step by step with rotations highlighted. Every run shows the Big-O table and the phase-highlighted reference implementation in four languages, and compared values can be played as pitch (sonification) through the shared audio engine. Everything runs client-side; inputs never leave the browser.

Ansible Playbook Generator

Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML