RandomSeed
System Variable RandomSeed
The random samples and random numbers generated by Analytica, or by any other software, are not truly random. They are called pseudo-random sequences. They are generated by deterministic algorithms. When these algorithms are started from the same initial state, they will reproduce the same random sequence. The "random seed" captures the state of the pseudo-random number algorithm.
This system variable allows you to reset the RandomSeed to an integer value.
The value of the system variable does not change as random numbers are generated, even though the internal seed does change. The internal seed has many more bits than fit in a single number, and is not accessible. Instead, RandomSeed stays at the previous value that you set it to. If the model is saved after you change this, then the random number generator will start from that new seed after your model is loaded.
You are allowed to assign to RandomSeed even from variable Definitions, which of course is in direct violation to the "no side-effects rule". Previously generated random numbers are NOT invalidated from this assignment. Doing this is quite useful when you want to ensure that your sequence always comes out the same, independent of the order in which the user evaluates variables, and independent of the number of times the variable has been re-evaluated.
Example
The Definition of a Chance variable might be:
RandomSeed := 9; Normal(0,1)
If you have a second chance variable that is also Normal(0,1) distributed, you would use a different RandomSeed number so that its sample is not identical to the first variable.
See Also
- Distribution Functions
- Random() function
- SampleType
- RandomType
Enable comment auto-refresher