Experimental

Random Walk Simulator

Simulate random walks in one, two and three dimensions and see distance growing with the square root of time, plus why a walk returns home in two dimensions and usually never does in three.

Last reviewed by the Radiatus Cloud team

Results appear here.

Need this done properly for your business?

Radiatus delivers secure cloud, DevOps & compliance engineering.

Book a free consult

Distance grows with the square root of the number of steps

A walker taking n unit steps in random directions ends up about the square root of n away from the start, not n. The steps mostly cancel, and what survives is the imbalance, which grows far more slowly than the count. That single relationship governs diffusion, the spread of a drop of ink, the width of a polymer chain and the error of a Monte Carlo estimate, and it is why doubling the accuracy of any of them costs four times the work.

Polya's theorem: a drunk finds home, a bird may not

A random walk on an infinite lattice returns to its starting point with probability one in one and two dimensions, and with probability about 0.34 in three. The usual phrasing is that a drunk man will always find his way home but a drunk bird may not. The reason is that the number of sites reachable grows faster than the walk can cover them once there are three dimensions to spread into, and the change happens exactly between two and three rather than gradually.

A simulation cannot demonstrate recurrence

Return probability approaches one in two dimensions but the expected time to return is infinite, so a finite simulation always shows some walks that have not returned. Reporting the observed return rate as if it were the probability is wrong in a way that gets more wrong with longer runs, not less. What a simulation shows is that the rate climbs slowly and does not settle, which is itself the evidence for the theorem rather than against it.

Related tools

Frequently Asked Questions

How far does a random walk travel?

About the square root of the number of steps. The steps largely cancel and only the imbalance survives, which is why distance grows so much more slowly than step count.

Does a random walk return to its start?

With probability one in one and two dimensions, and about 0.34 in three. That is Polya’s theorem, and the change happens exactly between two and three dimensions.

Why does my two-dimensional simulation not always return?

Because the expected return time is infinite even though the probability is one. Any finite simulation leaves some walks unreturned, and running longer reduces the fraction only slowly.

What does this have to do with diffusion?

It is the same process. A particle in a fluid is a random walk, and the square root law is why a drop of ink spreads as the square root of time rather than linearly.

Is a biased walk still a random walk?

Yes, and it behaves quite differently. Any bias makes the displacement grow linearly with time and eventually dominates the square root term entirely.

Privacy & Security

Everything runs in your browser; nothing is uploaded.

Data: None
Client-side-Side
Active
v1.0

How to Use

Choose dimensions and steps, then run the walks.

Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.