Urgent.News

What's breaking now, across thousands of outlets.

Science

The coin-flipping trick that counts the Internet

Here’s how the ubiquitous HyperLogLog algorithm works

The HyperLogLog algorithm offers a clever solution for estimating the number of unique visitors to a website without requiring the memory needed to store a full list of unique IDs. Instead of counting every page view, the algorithm relies on visitors to "flip coins" as they browse, which are transformed into a string of 0s and 1s using a hash function.

The site keeps track of the longest sequence of consecutive 0s observed among all visitors, which provides a close approximation of the total number of unique visitors. This simple approach allows websites to efficiently estimate audience size while using only a small amount of memory.

Written by urgent.news from Scientific American's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at scientificamerican.com →

More in Science

More from Monday 9 November →