Skip to content
Omnikalc

One-dimensional random walk calculator: mean position, standard deviation, expected distance and chance to return

Enter the number of steps, the step length and the probability of a forward step to get the mean position, the spread, the expected distance and the return probability.

Updated on
Your inputs

Value out of range

ft

Value out of range

%

Value out of range

Results

Standard deviation of the position

4.45 ft

Expected position after all the steps
2.00 ft
Expected distance from the start (normal approximation)
3.90 ft
Root-mean-square distance from the start
4.88 ft
Probability of being back at the start at the end
15.93 %

A random walk is a path made of random steps, such as a drunk walker, a particle or a gambler’s balance. The random walk calculator gives the mean position, the standard deviation, the expected distance from the start, the root-mean-square distance and the probability of returning to the start for a walk on a line.

How the calculation works

  • Enter the number of steps and the length of each step. The walker moves forward or backward on a line.
  • Enter the probability of a step forward. Use 50 % for a symmetric walk, where forward and backward are equally likely.
  • The position after n steps is L (2k − n), where k is the number of forward steps. The mean is n L (2p − 1) and the standard deviation is L √(4 n p (1 − p)).
  • The calculator also gives the expected distance from the start with a normal approximation, the root-mean-square distance and the probability of being back at the start after an even number of steps.

Example

A walker takes 20 steps of 1 ft, and each step goes forward with a probability of 55 %. The expected position is 20 × 1 × (2 × 0.55 − 1) = 2.00 ft and the standard deviation is √(4 × 20 × 0.55 × 0.45) = 4.45 ft. The expected distance from the start is 3.90 ft, and the root-mean-square distance is √(19.8 + 4) = 4.88 ft. The chance to be back at the start after 20 steps is C(20, 10) × 0.55¹⁰ × 0.45¹⁰ = 15.93 %.

Why it matters

The calculator helps students of probability, physics and finance, game designers and curious people to see how a random walk spreads with the number of steps, and how a small bias changes the result. It makes the square root law clear and gives exact values for the position and the return probability.

Good to know

The walk is on a line, with steps of fixed length and independent steps of the same probability. Walks in two or three dimensions, steps of random length and walls such as the ruin of a gambler are different problems. The expected distance uses a normal approximation, so it is less exact for few steps. The return probability is exact and is zero for an odd number of steps.

The gambler’s ruin calculator adds absorbing barriers, the Markov chain calculator handles transitions between states, the expected value calculator averages the outcomes of a random process, and the binomial calculator gives the chance of a number of forward steps.

Frequently asked questions

What is a random walk?

A random walk is a path made of random steps. In the simplest version, a walker on a line takes a step forward or backward at each time, with fixed probabilities. Random walks model the motion of molecules, the changes of a stock price, the path of a gambler's money and many other processes in which the next change does not depend on the past.

How far does a random walker go?

For a symmetric walk, the average position stays at zero, but the typical distance grows with the square root of the number of steps: after 100 steps of length 1, the typical distance is about 10, not 100. This square root law is a basic result of diffusion. If the walk has a bias, the drift grows in proportion to the number of steps and soon dominates.

What is the chance of returning to the start?

After an even number of steps n, the walker is at the start if exactly n/2 steps went forward. The probability is C(n, n/2) p^(n/2) (1 − p)^(n/2). For a symmetric walk it falls slowly, like 1 / √(π n / 2), so a walker on a line is almost sure to return to the start many times, which is not true in three dimensions.

Why is the expected distance an approximation?

The exact expected distance needs a sum over all the possible numbers of forward steps. The calculator uses the normal distribution, which is a good approximation when the number of steps is large, and gives a value that is a bit high for a small number of steps. For 20 steps at 55 % the exact value is 3.87 ft against 3.90 ft here.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.