You know the feeling. The highway is not full. There was no accident. And yet suddenly you are crawling. A lane change, a merge, someone taps the brakes. Gaps compress. A wave rolls upstream. Tomorrow, at the same hour, the road is fine.
Was yesterday’s jam real? Of course it was. Can you show it to a colleague? Often not. The next run of the day looks different.
That is the quiet problem of stochastic simulation: can we repeat the randomness? This post is about giving arrivals texture so a model feels alive, and giving randomness a seed so you can catch rare days, label them, and try inexpensive fixes before anyone proposes an extra lane.
Timing Intervals
In a simulation, “random” rarely means noise everywhere. It usually means a draw when a decision is needed - most often how long until the next thing happens. Those waiting times give the model its weather. Below are four everyday ways to describe them. Each one maps to something you already know from the road.
Fixed - the traffic light
A side street gets a green light every three minutes, and only then can cars pull out. The gap is always the same. That is a fixed interval: a metronome. Great for a clear baseline or for checking that the layout itself works. Poor at sounding like real traffic, where nothing is that tidy.
Exponential - cars at a junction
Now picture a free junction with no light. On average a car might arrive every few seconds, but the next one can come almost at once, or after a long quiet stretch. Gaps clump, then go empty. That bursty pattern is what an exponential interval is for. Sometimes called random timing.
Triangular - speed around a limit
The speed limit is 80. Nobody drives exactly 80 all the time. Some go about 70, most sit near 80, a few push toward 90. You do not need a lab study: only a low, a most-likely middle, and a high. That three-point guess is a triangular distribution. The same idea works for the gap between two cars: rarely too close, rarely too far, usually somewhere in between.
Empirical table - time at the gas station
Or you already measured it. At a gas station, a short stop of five minutes happens about 40% of the time, ten minutes 30%, fifteen 25%, twenty only 5%. Write those lengths and shares into a small table and play them back. That is an empirical table: not a formula, just what you saw. Also called a custom mix.
Each row below uses roughly the same average rate. Only the rhythm changes. Left: arrivals drifting along the line. Right: the shape of the gaps.
Interval · 0.9 s
Mean · 0.9 s
Low 0.4 s · mode 0.9 s · high 1.8 s
0.35 s @ 25% · 0.9 s @ 50% · 2.4 s @ 25%
Same average rate in each row. Left: arrivals already on the line. Right: gap shape.
If you can explain the timing to a colleague in one sentence, you probably picked the right family.
You can go further - most of the time you shouldn’t need to
Log-normal and truncated normal exist for a reason. Log-normal gives long right tails (never negative). Truncated normal is a bell curve cut to hard bounds. They are expert tools: useful when you have a statistical story, but easy to get wrong.
Hint: Prefer the simplest distribution you can defend. It makes the simulation easy to understand, reduces the risk of false assumptions, and leaves the complexity where it belongs: in the randomness.
Random seeds
Under the hood, a simulation asks a generator for the next number when it needs a choice: the next gap, which branch at a fork, which slot among equals. Everything else follows from the layout and those draws.
True randomness would give a different movie every run. That is rarely what you want in a simulation. Instead you start from a seed - a starting key for a mathematical generator. Same seed → same sequence of “random” numbers. Change the seed → a different sequence on the same stage.
A seed does not make randomness fake. It makes one particular stream repeatable, so you can re-watch it, share it, and compare fixes against it.
Try it with ten dice. Pick any seed from 1 to 100:
Statistics:
Min: —
Max: —
Average: —
Sum: —
Seed 26 gives the highest sum in that range. Roll it twice: the movie does not change.
A full simulation does the same trick with arrivals, routing, and a dozen other choices - just with more dice behind the curtain, usually on one shared stream.
Here is that idea as two timelines. Lock both runs to seed 42; they stay in step. Peel run B to seed 99; the weather diverges.
Both runs share seed 42 — arrivals stay in lockstep.
Catch the phantom jam
Back to the highway. Average capacity said the road was fine. Timing luck said otherwise.
Imagine the same road, same merge rules, arrivals with that exponential-ish clumping. You do not stare at one lucky run. You sweep - say a hundred seeds - and look for the extremes:
- Most seeds look fine. The road clears.
- A handful jam anyway, even though capacity said they shouldn’t.
- You open one of those bad seeds, watch the merge, and see why: a rare timing pattern lined up.
- Replay that same seed. The jam returns at the same model time. Now you can point at it.
Those bad seeds are your specimen jar. Seed 42 might be the cursed day; seed 99 a quiet one. The number is just the label on the jar.
Average capacity did not save you - a rare timing pattern did. Without a seed, the jam is an anecdote; with a seed, it’s evidence.
Cheap fixes
Once the jam is a named specimen, the question changes from “does this ever happen?” to “can we simply reduce the risk?”
| Expensive default | Cheap fixes |
|---|---|
| Build a whole extra lane | Soften a curve, add a speed limit, improve signs and markings |
An extra lane might brute-force the problem and cost a fortune. Often you only need to reduce the chance that a brake tap becomes a wave: a gentler curve, a speed limit, or simply a distance reminder.
Seeded runs let you A/B test the cheap idea. Change one lever and re-run. Did the jam disappear, move, or get rarer? That is how simulation earns its keep: cheaper, testable interventions before anyone pours concrete.
The same pattern shows up in material flow: “add another aisle” versus smooth a merge, a buffer, or a policy - and prove it on the cursed seed.
Once you can summon the jam on demand, try the inexpensive fix first, and prove on the same cursed seed whether the phantom went away.
Conclusion
Rare jams aren’t ghosts. They’re specimens. A seed labels the jar so you can open it again: show it to a colleague, sweep a season of seeds for the edge cases, and re-run the bad day after you change one lever.
That is the whole loop. Give arrivals a texture that feels like the road. Give the randomness a seed so a bad day is evidence, not a story you half-remember. Then try the inexpensive fix first, and only pour a new lane when the specimen still won’t die.
Randomness makes a simulation feel alive. A seed keeps you from losing the plot.