Probability

Random Walk

A random walk moves left, right, up, or down with equal probability. The path looks unpredictable, but the distance from the start grows like the square root of time.

5 minLevel 1/3The interactive stage stays ad-free.
Steps0 / 500Distance0.0√n0.0Ratio—

The amber path is one random walk. The dashed circle has radius √n, the typical distance after n steps — not n. Single walks look erratic, but their spread grows like the square root of time.

What you are seeing

1

Each step chooses a random direction. The walker has no memory of previous moves.

2

Individual paths are erratic, but many paths spread out in a predictable statistical pattern.

3

After n steps, the typical distance from the start is proportional to √n, not n.

Why it matters

Random walks model diffusion, stock prices, foraging animals, molecular motion, and search algorithms.

Complexity & details

Each step is O(1). Simulating n steps is O(n).

Frequently asked questions

Why √n instead of n?+

Steps in opposite directions cancel. The variance grows linearly with n, so the standard deviation grows like √n.

Is a random walk the same as Brownian motion?+

Brownian motion is the continuous-time limit of a random walk with very small steps taken very often.