The Random Walk
π A random walk: take a random step, then another, then another. Simple rule, surprisingly rich behavior β our first toy model of an animal exploring.
Picture a rat dropped into a fresh box. We model its wandering with the crudest possible assumption: at every tick of the clock, it takes a random step in x and a random step in y, each drawn from that uniform distribution you just used. Stack up those steps and you get a jittery path β a drunkard's walk.
x[k+1] = x[k] + (random_step β 0.5) Γ step_size
Next position = current position + a centered random nudge. Subtracting 0.5 centers the U(0,1) step around zero, so the rat is equally likely to go left or right.
One-line mantra: "where you'll be = where you are + a random nudge." That's the whole engine. (We also clamp x and y to stay inside the [0,1] box, so the rat can't walk through a wall.)
The rat starts at the green dot and each step moves a random amount in x and y, ending at the red dot. It explored roughly 124% of the arena. Bigger step size = the rat moves faster (or we sample it less often), so it roams more of the box in the same number of steps.
Green dot = start, red dot = finish. Try both sliders: more steps = longer wander; bigger step size = the rat covers more of the box in the same number of steps.
Two things to notice while you play: (1) A bigger step size means the rat moves faster β or that we're checking on it less often. (2) With big steps it visits more of the arena; with tiny steps it barely leaves where it started.
π§ Callback + AI tie-in: this same random-walk math becomes the drift-diffusion model of decision-making β evidence "walks" up toward a choice. You'll meet it again on Hidden Dynamics day. Real rats don't move purely randomly, but sampling like this is how you approximate messy behavior.