Random seeds and reproducible simulation

Use seeds to replay random choices, and record the rest of the run setup needed to reproduce a result.

On this page
  1. A seed selects a repeatable random sequence
  2. A seed by itself is not a reproducibility record
  3. Distinguish random-draw replay from full result replay
  4. Do not confuse replay with replication
  5. Same seed, same sequence

A seed selects a repeatable random sequence

A random seed is the starting point for a pseudo-random number generator. If the model, run settings, random-number algorithm, and seed are unchanged, the same random choices can be replayed.

That makes a seed useful for debugging and for returning to a surprising run.

Advanced details: what a seed does not freeze

A seed identifies a starting state for a particular generator. For example, if a service step consumes one extra random value, the next service may receive what used to be the following draw, even though the seed has not changed.

A seed by itself is not a reproducibility record

For replay, record the model and scenario revisions; input data and transformations; run horizon and warm-up cutoff; which observations count; engine and generator versions; stream assignments; execution settings; and seed. Changing any one can change the result.

Distinguish random-draw replay from full result replay

The same generator, seed, and draw order can repeat the random-number sequence. To repeat the full output, event scheduling and model execution must also be equivalent. A matching seed alone does not establish that browser and native runs, or sequential and concurrent runs, will agree.

Giving arrivals and service times separate streams can stop an extra service draw from shifting future arrival draws. Stable per-entity streams can preserve more pairings when routes diverge. Neither allocation scheme should be described as a Polymodus guarantee without testing its implementation.

Do not confuse replay with replication

Reuse a seed when you want the same realization again. Change the random stream when you want another replication of the same experiment.

Same seed, same sequence

Set the same seed twice in the demonstration and compare the generated values. Then change the seed and compare again. This exercise demonstrates sequence replay, not cross-runtime Polymodus equivalence.

References