randarium
Data

Zipf Distribution Sampler

Generate reproducible samples from a Zipf distribution over ranks 1..n with configurable exponent. Optionally map ranks to custom labels for frequency-based scenarios.

Also known as: zipfian sampler · rank frequency

seeded

Presets

Number of ranks

Exponent

Optional: one label per line; rank maps to line

Output

No output yet — set your options and hit .
About this tool, tips & examples

What it does

The Zipf Distribution Sampler draws from the power law that governs popularity: rank 1 dominates, rank 2 gets roughly half the attention, and the long tail stretches out forever. Configure the number of ranks (up to 10,000) and the exponent (steep or flat), optionally map ranks to your own labels, and generate up to 10,000 samples — seeded and reproducible.

Common use cases

  • Realistic frequency data — word usage, page views, product popularity, and city sizes are all approximately Zipfian; uniform test data lies about them.
  • Cache and hot-key testing — Zipfian access patterns are the standard workload for caches and databases, because that’s what real traffic looks like (a few hot keys, a long cold tail).
  • Search and IR experiments — query and term frequencies for ranking and index tests.
  • Labeled scenarios — map ranks to your own labels (“home”, “search”, “checkout”…) for instant realistic event streams (a preset shows it).

Settings

  • Number of ranks — the population size, 1 to 10,000.
  • Exponent — the skew dial: ~1 is classic Zipf, higher is steeper (presets for default, steep, and flat).
  • Labels — optional rank→label mapping, one per line.
  • How many — 1 to 10,000 samples.
  • Seed — identical seed + settings = identical sample.

Privacy note

Samples are computed locally in your browser; nothing is uploaded — synthetic draws from an ideal distribution.

FAQ

Why does Zipf matter for testing? Because uniform load hides hot-spot bugs. A cache that looks fine under uniform keys can thrash under Zipfian traffic — testing with the real shape finds it before production does.

What does the exponent change? Concentration: at 1.0, rank 1 gets ~7% of a 1,000-rank stream; at 2.0 it dominates outright; near 0 the distribution flattens toward uniform.

Where else does this shape appear? Word frequencies (the original Zipf), city populations, wealth, GitHub stars, npm downloads — power laws are everywhere attention accumulates. The Distribution Sampler has the rest of the distribution family.