Home▸Data Science▸Zipf's Law from Random Typing: Monkey Text, Word-Length Blocks and the Exponent alpha

Zipf's Law from Random Typing: Monkey Text, Word-Length Blocks and the Exponent alpha

A monkey hits m letter keys and the space bar at random. Words are the letter runs between spaces, and their rank-frequency plot is a straight Zipf line with exponent alpha = ln(m/(1-q))/ln m, close to 1. Watch a Blender typewriter produce thousands of words, towers at ranks 1, 2, 4, 8 ... grow, vocabulary follow Heaps' law and word lengths follow q(1-q)^(L-1). Change keys, space probability, corpus size and the seed, and compare the exact theory with the typed text.

Data Science3DModerate60 FPS📱 Mobile-adapted🟠 Blender⇄ 2D version
Zipf's Law from Random Typing: Monkey Text, Word-Length Blocks and the Exponent alpha ↗ Open standalone

A monkey hits m letter keys and the space bar at random. Words are the letter runs between spaces, and their rank-frequency plot is a straight Zipf line with exponent alpha = ln(m/(1-q))/ln m, close to 1. Watch a Blender typewriter produce thousands of words, towers at ranks 1, 2, 4, 8 ... grow, vocabulary follow Heaps' law and word lengths follow q(1-q)^(L-1). Change keys, space probability, corpus size and the seed, and compare the exact theory with the typed text.

⚙ Under the hood

A monkey hits m letter keys and the space bar at random. Words are the letter runs between spaces, and their rank-frequency plot is a straight Zipf line with exponent alpha = ln(m/(1-q))/ln m, close to 1. Watch a Blender typewriter produce thousands of words, towers at ranks 1, 2, 4, 8 ... grow, vocabulary follow Heaps' law and word lengths follow q(1-q)^(L-1). Change keys, space probability, corpus size and the seed, and compare the exact theory with the typed text.

Zipf's LawRandom TypingHeaps' LawRank-FrequencyWord StatisticsPower LawMonte Carlo

3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)