What this shows
Each colored path is one walker. All walkers start at the same point (the center of the viewport) and move independently. At every step, a walker picks a direction uniformly at random and moves a fixed distance in that direction. This is often called an isotropic or Pearson random walk in the plane.
How the visualization works
- The simulation keeps only the current position of every walker. It advances in whole, discrete steps, so frame rate never changes the outcome.
- Every random direction comes from a seeded pseudo-random generator. The same seed, walker count and step size always produce the same paths, which is why the seed is part of the shareable URL.
- The renderer draws the segment each walker covered since the previous frame into an offscreen texture. At high speeds several steps can happen between frames, and the drawn segment then joins the sampled positions rather than every intermediate step.
Parameters
- Walkers: how many independent walkers to simulate. Changing it restarts the run from the seed.
- Step size: the length of each step, in screen pixels. Applies immediately.
- Speed: steps per second. Applies immediately.
Mathematical background
Write the position of one walker after n steps as Xn = ξ1 + ξ2 + … + ξn, where each step ξk has length s and a uniformly random direction, independent of the others. Each step has mean zero, so the expected position stays at the origin. For the squared distance, the cross terms E[ξj · ξk] vanish for j ≠ k, leaving
E[|Xn|²] = n·s².
The typical (root-mean-square) distance from the start therefore grows like s·√n: to get twice as far, a walker needs about four times as many steps. You can see this in the way the cloud of walkers spreads quickly at first and then more and more slowly.
By the central limit theorem, for large n the distribution of Xn / (s·√n) approaches a two-dimensional Gaussian. Rescaled appropriately, random walks converge to Brownian motion, which connects this picture to diffusion.
References
The problem was posed by Karl Pearson in a 1905 letter to Nature and answered by Lord Rayleigh in the same volume. Full citations are listed below.
- Karl Pearson. The Problem of the Random Walk (1905). Nature 72, 294. Pearson's letter posing the problem.
- Lord Rayleigh. The Problem of the Random Walk (1905). Nature 72, 318. Rayleigh's reply to Pearson's letter.