Stochastic models require a random seed value for the pseudorandom number generator. In this case model runs cannot be reproduced since the model random number generator is initialized with different values for each model run. Specifying the fixed seed value, you initialize the model random number generator with the same value for each model run, thus the model runs are reproducible.
If the model does not receive any external input (either data or user actions), the behavior of the model in two simulations with the same initial seeds is identical. The random number generator is initialized once when the model is created and is not reinitialized between model replications.
In some rare cases the model may output non-reproducible results even with the option
Fixed seed (reproducible experiments)
being selected. These situations are described
here.
By default, all probability distribution functions in AnyLogic, the Process Modeling Library blocks, the random transitions and events, the random layouts and networks and the AnyLogic simulation engine itself – in other words, all randomness in AnyLogic, is based on the default random number generator. The default random number generator is an instance of the Java class Random, which is a Linear Congruental Generator (LCG).
If for any reason you are not satisfied with the quality of Random, you can:
To substitute the default RNG with your own RNG
The initialization of the default RNG (provided by AnyLogic or by you) occurs during the initialization of the experiment and then before each simulation run.
In addition you can substitute the default RNG at any time by calling:
setDefaultRandomGenerator( Random r )
However you should be aware that before each simulation run the generator will be set up again according to the settings on the General page of the experiment properties.
To use a custom RNG in a particular call of a probability distribution function