Please enable JavaScript to view this site.

Vensim Help

Navigation: Reference Guide > Functions > Random Functions


Scroll Prev Top Next More


Version 6.3 introduces a new parameter for control of the pseudorandom number generator (PRNG) used by the RANDOM functions.


NOISE RNG is a special variable, like NOISE SEED, that is used to select the PRNG. Normally, you do not need to add NOISE RNG to models; if it is absent, the default generator will be used. If you need to run a model with the legacy generator, add a constant named NOISE RNG to the model and set its value to -1.


NOISE RNG may take one of the following values:


0 (Default, recommended) - same as 1 (we do not expect to change the default, but this setting is provided to facilitate future PRNG updates, should any occur)

1 - the SIMD implementation of the Mersenne Twister, by Mutsuo Saito and Makoto Matsumoto. This is an extremely robust generator, with a period of 2^19937-1.

-1 (Deprecated) - the legacy linear congruent generator (LCG) from Vensim versions through 6.2. Three linear-congruent generators are used.  The first one generates the most significant portion, the second generates the least significant portion, and the third randomly picks one from a list of previously generated numbers.

-2 (Deprecated) - the legacy subtractive Knuth generator from Vensim versions through 6.2, which was generally not accessible except in optimization.


Other values are reserved for future use. If encountered, they will be treated as 0 and a warning will be issued.


The Mersenne Twister (MT) is based on code generously made available by the authors, described in Mutsuo Saito and Makoto Matsumoto, "SIMD-oriented Fast Mersenne Twister: a 128-bit Pseudorandom Number Generator", Monte Carlo and Quasi-Monte Carlo Methods 2006, Springer, 2008, pp. 607 -- 622. DOI:10.1007/978-3-540-74496-2_36.

The legacy methods are based on routines given in Numerical Recipes inĀ  C, by Press, Flannery, Teukolsky, and Vetterling.

The MT algorithm used is known to pass the Diehard tests and most of the Dieharder and TestU01 tests. For simulation use it is expected to perform in demanding situations.

Prior to release, we tested the actual implementation in Vensim using the NIST Statistical Test Suite ( We examined both the raw bits and binary sequences constructed by testing whether each floating point random number exceeds 0.5. All tests pass for batches exceeding 2 million draws.

Note that the MT generates 32 bit unsigned integers (about 4 billion distinct values), which are then mapped to (0,1) uniform random floating point numbers (exclusive of the endpoints). A double precision number has a 52 bit mantissa, so the least-significant bits are not populated in double precision calculations. This is not expected to be a limitation for any practical purpose.


See Also:


Optimization Options, Sensitivity Simulations


Andrew Rukhin, Juan Soto, James Nechvatal, Miles Smid, Elaine Barker, Stefan Leigh, Mark Levenson, Mark Vangel, David Banks,Alan Heckert, James Dray, San Vo (2010) A Statistical Test Suite for Random and Pseudorandom Number Generators for Cryptographic Applications. National Institute of Standards and Technology, Special Publication 800-22 Revision 1a