Probabilistic counter

This probabilistic counter algorithm estimates a total while making fewer counter updates. With a block size of N, each event has a 1-in-N chance to add N; otherwise, it does nothing. Compare it with counting every event exactly. Use the same seed to repeat a run, or change the seed to see how the estimate varies.

CounterValueWrites
Exact——
Sampled——

Run to compare the counts.

Fewer writes, not a guaranteed error bound or speedup. All writes here are simulated.