Watch multiple walkers diffuse in real time. The MSD log-log plot reveals the diffusion law. Switch between lattice, Gaussian, and Lévy flight walks.
Parameters
Preset
Gait Type
Walkers 120
Step length a 4
Steps per frame 2
What this tool shows
Many walkers start at the origin and move independently in a random direction at each step. You can simultaneously observe their cloud-like spreading paths,⟨r²⟩ ∝ N the straight line forand the endpoint distribution converging to a Gaussianas predicted by the central limit theorem.
Results
0
Steps N
0
Walkers
0.0
⟨r²⟩
0.00
⟨r²⟩/N (measured)
0.0
RMS displacement
Walk
Walker pathsOriginWhite cross at center = starting point (origin).
Msd
Measured ⟨r²⟩Theory a²·N (linear diffusion law)⟨r²⟩ ∝ N (diffusion): line slope = a².
Theory & Key Formulas
Endpoint x histogramGaussian fitEndpoint distribution → Gaussian (sum of many independent steps).
Theory & Key Formulas
When each step is independent with zero mean and constant variance, the 2D mean-square displacement grows in proportion to the number of steps:
$$\langle r^2(N)\rangle = N\,a^2 = 4Dt$$
Here, $a$ is the step length and $D$ is the diffusion coefficient, with $D=a^2/(4\,\Delta t)$. On a log-log plot, this is a line with slope 1—thesignature of normal diffusion. The variance of each component is $\langle x^2\rangle = N a^2/2$, and because the endpoint distribution is a sum of many independent steps, thecentral limit theoremcauses it to converge to a Gaussian distribution. In 2D, return to the origin has probability 1 (Pólya's theorem).
Validation example: a=4, N=200 → ⟨r²⟩≈Na²=3200. The slope ⟨r²⟩/N converges to a²=16.
What is a 2D Random Walk?
🙋
What exactly is a "random walk"? It just looks like a bunch of dots wandering around randomly on the screen.
🎓
Basically, it's a mathematical model for the path of something that takes successive random steps. In this simulator, each "walker" is like a pollen grain being jostled by water molecules. Try hitting "Start" with just 1 walker and watch its path—it's the purest form of unpredictable motion.
🙋
Wait, really? So the "Mean Squared Displacement" (MSD) plot is measuring how "spread out" they get over time?
🎓
Exactly! The MSD, $\langle r^2(t)\rangle$, is the average squared distance from the starting point. For normal diffusion—like our pollen grain—theory says it grows linearly with time. You can see this by running the "Lattice" walk with many walkers and watching the blue MSD line. The red theoretical line, $4Dt$, should match it closely.
🙋
What happens when I switch from "Lattice" to "Gaussian" or "Lévy Flight" in the dropdown? The paths look totally different.
🎓
Great observation! You're changing the fundamental step rules. "Lattice" walks on a grid. "Gaussian" takes steps of any length, following a bell curve. "Lévy Flight" allows for rare, huge jumps. This changes the diffusion regime. Check the log-log MSD plot: a slope of 1 means normal diffusion. Try "Lévy Flight" and increase the "Step Power Law" slider—you'll see superdiffusion where the slope becomes greater than 1!
Physical Model & Key Equations
The core measure of a random walk is the Mean Squared Displacement (MSD). It quantifies how far the walkers have wandered, on average, after a certain time.
$$\langle r^2(t) \rangle = 2 D t$$
Here, $\langle r^2(t) \rangle$ is the mean squared displacement at time $t$, $D$ is the diffusion coefficient (which depends on step size and rate), and the factor 2 is for two dimensions. This linear relationship defines normal diffusion.
To identify different types of motion, we often use a power-law form and analyze it on a log-log plot.
$$\langle r^2(t) \rangle \propto t^{\alpha}$$
The exponent $\alpha$ is the anomalous diffusion exponent . On the simulator's log-log plot, the slope of the MSD curve is $\alpha$. If $\alpha = 1$, it's normal diffusion. If $\alpha \lt 1$, it's subdiffusion (trapped, crowded). If $\alpha \gt 1$, it's superdiffusion (directed or Lévy flight).
Real-World Applications
Pollution & Contaminant Spread: Modeling how a pollutant disperses in groundwater or air is a classic random walk problem. Engineers use these simulations to predict contamination plumes and design remediation strategies, often needing to account for anomalous diffusion in porous soils.
Financial Market Modeling: The random walk hypothesis suggests stock price movements are unpredictable, similar to a particle's Brownian motion. "Lévy flight" models, which you can simulate here, are used to better capture the rare, large price jumps (crashes or rallies) seen in real markets.
Animal Foraging Patterns: Many animals, from albatrosses to deer, do not search for food in simple Brownian paths. Biologists use Lévy flight models (switch the simulator to this mode) to describe patterns with many short moves and occasional very long jumps, which is an optimal search strategy in sparse environments.
Polymer Physics & Materials Science: The conformation of a polymer chain in a solution can be modeled as a random walk. Understanding whether its motion is normal or subdiffusive (slowed by obstacles) is key for designing gels, plastics, and pharmaceutical delivery systems.
Common Misconceptions and Points to Note
First, it's easy to think that "the diffusion coefficient D is a constant determined solely by the type of particle," but this is a misconception. For example, even the same molecule will diffuse at completely different speeds in water versus in oil. In this simulator, try setting the "Walker Type" to "Continuous," keeping the "Step Size" fixed, and moving the "Diffusion Coefficient" slider. You'll see the "liveliness" of the particle's motion change, right? This means the diffusion coefficient depends strongly on the "environment (e.g., viscosity)" and "temperature." In practice, the first step is correctly setting the value of D used in your simulation based on experimental or literature values.
Next, do not judge the MSD graph based on a single run. Especially when the number of walkers is low, the MSD plot can be quite scattered. If you run a "Lattice" walk with just 1 walker, you should see that the MSD does not form a perfect straight line. This is statistical fluctuation. To obtain reliable results, you need to run the simulation with a sufficient number of walkers (e.g., 100 or more) and take the average.
Finally, be careful when setting parameters for Lévy Flight. If you set the power exponent α to a value close to 2.0 (e.g., 2.1), it will appear almost indistinguishable from a normal random walk. To clearly see the characteristics of superdiffusion, set α between 1.5 and 2.0. However, if you set α too low (e.g., 1.1), extremely long jumps can occur, potentially causing the particle to immediately leap out of the simulation area. When applying this to real phenomena, a process of carefully estimating α from observational data is essential.
Set particle count (valN) between 100–10,000 particles; higher counts show ensemble statistics more clearly
Configure step size (valStep) in micrometers: 0.1–10 μm typical for molecular diffusion studies
Apply optional drift velocity (valDriftX) in μm/s to impose directional bias (0 for pure diffusion)
Select walk mode: lattice for grid-based motion, Gaussian for continuous displacement, or Lévy for anomalous diffusion
Adjust Lévy exponent (valAlpha) between 0.5–2.0; lower values produce heavy-tailed jumps
Run simulation and observe mean-squared displacement (MSD) growth; MSD ∝ t validates diffusion coefficient estimation
Worked Example
Simulate colloidal gold nanoparticles (50 nm diameter) in water at 25°C. Set N=1000 particles, step size 0.5 μm, drift 0 μm/s (pure diffusion), Gaussian mode. After 500 time steps (Δt=1 ms each), MSD reaches approximately 2.5 μm². From Einstein relation D = MSD/(4t), calculated diffusion coefficient D ≈ 1.25×10⁻¹² m²/s, matching Stokes–Einstein prediction for this particle size and medium viscosity.
Practical Notes
Lattice mode enforces discrete jumps (4-neighbor or 8-neighbor connectivity); use for polymer chain segments on fixed meshes
Gaussian continuous walks approximate real Brownian motion; select for liquid-phase particle tracking experiments
Lévy flights (α < 2) model superdiffusion in turbulent dispersion or anomalous transport in porous media; MSD grows as t^(α) rather than linear
Drift velocity breaks symmetry; useful for simulating electrophoretic or pressure-driven transport superimposed on thermal diffusion
Small step size (<0.1 μm) increases computation time but improves resolution; balance against physics timescale
🎬 Watch it in motion
Diffusion-Limited Aggregation | random walkers grow a fractal tree #Shorts
Brownian Motion | random jitter spreads exactly with time #Shorts