At a glance
Every walker starts at the same point and, on each tick, steps a distance s left or right on a fair coin flip. The sim runs a crowd of them at once, so you can measure how far random steps carry a walker, and how reliable that measurement is.
What you'll learn
- How the typical distance from the start depends on the steps N and the step length s.
- How to read the histogram of positions and the curve over it.
- How far a spread measured on W walkers can stray from the law.
- How the same idea describes molecules moving through a gas.
What's on screen
- Walkers (orange dots, top): where each walker stands. Only the horizontal position matters; the vertical scatter is decoration.
- Histogram (grey bars, bottom): walkers per site, on a fixed frame of ±140.
- Teal curve over the bars: a reference curve, drawn from N = 10.
- Spread chart (right): the measured spread against √N, with reference lines and a shaded band.
- Readouts: steps taken N, the Spread, and a Predicted value.
The controls
Press ⌖ on a row to see where that control sits in the sim.
| Control | What it changes | Range | |
|---|---|---|---|
| walkers W | How many independent walkers take part. Moving it restarts the run. | 10–2000 opens at 200 | |
| step length s | The length of every hop, in the units of the ±140 frame. Moving it restarts the run. | 0.5–2.0 opens at 1.0 | |
| steps per second | How fast ticks arrive. It paces the run and does not change what a tick does. | 1–30 opens at 8 | |
| Step everyone once | Moves every walker by exactly one tick, so you can go slowly. | button | |
| Readouts | Steps taken N; the Spread, the RMS distance from the start, √(Σxᵢ²/W); and a Predicted value to compare it with. | panel | |
| ▶ Play / ⏸ Pause | Runs or freezes the walk. The run stops itself at N = 400; pressing Play again starts a fresh run. | top bar | |
| Speed | Plays the ticks faster or slower on screen, on top of steps per second. The walk itself is unchanged. | 0.25×–4× | |
| ↻ Reset | Puts W = 200, s = 1.0 and 8 steps per second back, and starts a fresh run. | top bar |
Fixed: the coin is fair, every walker starts at 0, and the random sequence is seeded, so the same W and s always replay the same run.
What each tick does
On every tick each walker flips its own fair coin and moves s to the right or to the left. The flips are independent of every other walker and of the walker's own past.
- The average position stays at 0. Left and right are equally likely, so ⟨x⟩ = 0 at every N. That is a statement about signs, not about how far individual walkers have gone.
- Positions come in steps of 2s. After N ticks, x/s = (steps right) − (steps left), which has the same parity as N. After an even number of ticks only even multiples of s are occupied, after an odd number only odd ones. The whole set of occupied sites shifts by s on each tick.
- One tick is easy to read. Every walker is at +s or −s, so the Spread is exactly s.
Squares add, so the spread grows as √N
What accumulates is not the distance but its square. Squaring the position after N ticks:
- Each tick adds exactly s² to the mean square. The RMS distance, which is what the Spread reads, is s√N.
- Four times the steps give twice the spread. Against √N the spread is a straight line of slope s.
- The red dashed line y = Ns on the chart is the counterfactual: every step going the same way.
| Steps | Spread, s = 1 | All steps one way |
|---|---|---|
| N = 1 | 1 | 1 |
| N = 100 | 10 | 100 |
| N = 400 | 20 | 400 |
A sample wobbles about the law
⟨x²⟩ = Ns² is an average over all possible walks. The Spread is measured on only W walkers, so it scatters about s√N.
These sliders move the sim too, and restart its run.
- One standard deviation is about 1/√(2W): roughly 10% at W = 50, 5% at W = 200, 2.2% at W = 1000.
- A trace that wanders inside the shaded band is sampling scatter, not a failure of the law. More walkers narrow the band; they do not move the law.
- Every N is measured on the same W walkers, so the trace drifts rather than re-rolling at each tick.
The histogram follows a Gaussian
The exact distribution after N ticks is binomial. It is a bell shape only in the limit of large N.
- For large N this approaches a Gaussian of standard deviation s√N. The sim draws it over the bars from N = 10, where the biggest gap is about 2.5% of the curve's peak. By N = 100 it is 0.25%.
- Sites are 2s apart, so the curve is scaled by the site spacing to give walkers per site:
- The Gaussian is an approximation. No walker can be beyond ±Ns, so the real crowd has no tails past that.
Where it matters
- A scent crossing a room. Take a molecule at about 500 m/s with about 70 nm between collisions (round numbers; real values vary). Crossing 3 m by random steps alone needs N = (3 m / 70 nm)² ≈ 1.8 × 1015 steps, roughly 3 days. Real rooms mix faster because air currents carry the scent.
- Brownian motion. A grain of pollen or a colloidal particle in water is kicked in random directions by molecules, so its mean square displacement grows in proportion to time.
- Polymers. An ideal freely jointed chain of N segments of length b has an RMS end-to-end distance b√N.
Go deeper: from steps to a diffusion constant
- With N = t/τ, the law ⟨x²⟩ = Ns² becomes ⟨x²⟩ = 2Dt, with D = s²/2τ. Mean square displacement grows in proportion to time: that is diffusion.
Summary
Key points
- The average position stays at 0 while the spread grows as s√N: four times the steps, twice the spread.
- The Spread readout is a sample of W walkers, so it scatters about s√N by roughly 1/√(2W).
Common mix-ups
- "Distance from the start grows in proportion to the number of steps." Steps mostly cancel. The square of the distance grows in proportion to N, so the distance grows as √N.
- "The mean displacement is zero, so the walkers go nowhere." ⟨x⟩ = 0 and ⟨x²⟩ = Ns² are both true: the crowd stays centred while it spreads.
- "The Spread is the average distance from the start." It is the root-mean-square, which weights far walkers more. The mean of |x| is smaller: about 0.80 s√N at large N.
Things to try on your own
- Set s = 2, run to N = 400 and compare the Spread with the Predicted value.
- Press Step everyone once with s = 0.5 and read the Spread.
- Drag W from 50 to 2000 at the same N and note how the shaded band changes.