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. Do not confuse replay with replication
  4. 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 selects a sequence for a particular pseudo-random generator. Changing the generator, changing which random stream a component uses, or inserting an extra random draw can change later values even when the numeric seed is unchanged.

A seed by itself is not a reproducibility record

Save the model revision, scenario, run length, warm-up rule, input data, software version, and seed. If any of those change, the same seed does not guarantee the same simulation result.

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

The example below shows why replay and statistical replication are different jobs.

References