Random Walk Simulator
Start at zero and take two hundred steps, each one forward or back on a coin flip. The line that comes out looks like it has a trend, a recovery, a run of bad luck — and it has none of those, because every step was independent of every step before it. That is what makes a random walk worth looking at: it is the clearest demonstration that patterns we are certain we can see are things we bring rather than things that are there.
What this generator does
Runs a one-dimensional symmetric random walk and reports where it finished, how far it strayed, how often it returned to the start and its longest run in one direction — then gives the exact probability of finishing that far out or further. The other simulation-adjacent page here draws samples from a normal distribution; this one produces a *path*, where each value depends on the one before it, which is what makes the visible-but-absent trend possible.
How to use this tool
- Choose how many steps to take.
- Press Take the walk.
- Read the chart, and the statistics under it.
- Walk again — the shape changes completely and the statistics barely do.
Understanding the controls
- Number of steps
- How many coin flips the walk takes. Longer walks stray further in absolute terms but not proportionally — typical distance grows with the square root of the steps, so four times the steps is only twice the distance.
Worked examples
- 200 steps
- Typically finishes about 11 places from the start, in either direction. Finishing at exactly zero is uncommon and finishing 40 out is rare.
- The chart
- Usually looks like it has trends and reversals. It has neither — every step was an independent coin flip.
- Returns to the start
- Often a handful, sometimes none. A walk that goes early and stays away is entirely ordinary.
- What is never claimed
- That a walk which is down is due to come back up.
Common use cases
- Showing a class what independent random steps actually look like
- Demonstrating why a trend in a chart is not evidence of a cause
- Getting a feel for how far a random process drifts over time
- Illustrating the gambler's ruin problem with a real path
- Generating an example path for a lesson, a slide or a write-up
How this generator works
Each step is a single draw from the browser's cryptographic random number generator, mapped to plus or minus one, and the position is the running sum. Nothing is smoothed and nothing is pre-computed — the chart is drawn directly from the positions. The exact probability under the result comes from the binomial distribution the walk actually follows: after n steps the position is 2h − n where h is the number of forward steps, so the chance of each endpoint is a binomial coefficient over 2^n, computed in integer arithmetic. The typical-distance figure is the standard expected absolute displacement, the square root of 2n over pi.
Randomness and fairness
Every step is an independent draw from the browser's cryptographic random number generator — there is no seed and no pre-computed path, so no two walks are the same. The walk has no memory whatsoever: being nine places down does not make the next step likelier to go up, and the tool never suggests otherwise. The exact probability quoted alongside the result is computed rather than sampled.
For how randomness is produced across the whole site, see how Generate Random works.
Assumptions this tool makes
- Steps are independent, equally likely in both directions, and all the same size. This is the symmetric simple random walk; asymmetric and weighted walks behave quite differently.
Limitations and good to know
- One dimension only, with steps of equal size. Two-dimensional walks and variable step sizes behave differently in ways this does not show.
- It is a mathematical object, not a model of anything in particular. It is not a price simulator, and a walk that looks like a chart you recognise is a coincidence rather than a finding.
- The exact probability shown is for the finishing position alone. Questions about the path — the chance of ever reaching a level, say — are a different and harder calculation that this does not attempt.
- The chart is drawn at a fixed size, so a two-thousand-step walk is dense. That is honest about the data rather than smoothed.
Common mistakes
- Seeing a trend in the line
- There is no trend to see — each step was an independent coin flip and the process has no drift at all. What looks like a trend is the accumulation of independent noise, and recognising that is most of the value of watching one of these.
- Expecting the walk to come back to zero
- A one-dimensional walk does return to the start infinitely often given infinite time, which is a genuine theorem and a terrible guide to a two-hundred-step walk. Over any finite run, straying and staying away is completely normal.
- Reading it as a model of prices or luck
- It is neither. Real markets are not symmetric walks and a losing streak in a game is not a walk that owes you a recovery. Using this as evidence about either is exactly the reasoning error it is best at illustrating.
Practical tips
- Walk five times at the same length. The shapes are wildly different and the summary statistics are remarkably similar — which is the point.
- Compare 100 steps with 400. The typical distance only doubles, because it grows with the square root.
- Look at the longest-run figure alongside the coin run calculator, which gives the exact distribution that figure is drawn from.
Privacy and your data
Only a step count is entered. The walk is generated in your browser, nothing is uploaded, and no path is stored. Analytics records that the tool ran and how many steps were taken, never the path.
Frequently asked questions
- Why does the line look like it has trends?
- Because a running total of independent steps drifts, and drift is indistinguishable from trend by eye. Nothing in the process pushes in either direction — the appearance of momentum is produced entirely by accumulation, and it is the single most useful thing a random walk demonstrates.
- How far should a walk get from the start?
- About the square root of twice the number of steps, divided by pi, then square-rooted — around 11 places for 200 steps. The page shows this figure alongside the result, and the exact chance of finishing at least as far out as you did.
- Is this a Monte Carlo simulation?
- It is one run of one, which is not really what the term means. Monte Carlo methods run many simulations and take statistics over them — if you want that shape, the coin run calculator does exactly it, running two thousand sequences and comparing the results against the exact answer.
- Can I use this to model a stock price?
- No, and it is worth saying why rather than just declining. Real price series are not symmetric — they have drift, their steps vary in size, and their volatility clusters. A symmetric walk with fixed steps captures none of that, and a walk that happens to resemble a chart you know is coincidence.
Related generators
- Coin Run Probability CalculatorHow likely a streak of heads really is — counted exactly across every possible sequence, then simulated so you can watch the two agree.
- Normal Distribution Sample GeneratorA random sample from a normal (bell-curve) distribution, mean 50.
- Probability GeneratorA random '1 in N' probability statement with its equivalent percentage.