Skip to content
View Categories

Set Random Seed

Random Seed

Monte Carlo simulations rely on random numbers to generate variation in biological inputs such as colostrum quality, feeding age, birth weight, and other user-defined distributions. Although the statistical properties of these random numbers are identical from one simulation to the next, the actual sequence of numbers changes each time the program is run.

A random seed is simply the starting value used by the random number generator. When the same seed is supplied, the program generates exactly the same sequence of random numbers every time. Consequently, two simulations using identical project settings and the same random seed will produce identical results.

When no random seed is specified, CMC automatically generates a different sequence of random numbers for every simulation. This behavior reflects how Monte Carlo analyses are normally performed and is appropriate for routine use.

Why use a random seed?

A fixed random seed is valuable whenever simulation results must be reproduced exactly. Examples include:

  • Verifying software updates 
  • Comparing alternative model equations 
  • Testing the effects of changing individual parameters 
  • Reproducing published analyses 
  • Collaborating with other researchers 

Because every random value is reproduced, differences observed between two simulations can be attributed solely to changes made by the investigator rather than differences in the random sampling process.

Important considerations

Using a random seed does not make the simulation more accurate or more realistic. It simply makes the sequence of random numbers repeatable.

For routine analyses, leaving the random seed disabled is generally recommended. When documenting research results, however, recording the random seed allows other investigators to reproduce the simulation exactly.

When a random seed is enabled, CMC records the seed value on printed reports to facilitate reproducibility.

Powered by BetterDocs