Stream ID

<< Click to Display Table of Contents >>

Navigation:  Reference Manual > Functions > Random Functions >

Stream ID

Previous pageReturn to chapter overviewNext page


The last parameter s of the RANDOM functions identifies an independent random number stream to use.

Generally, all random variables in a model should draw from one or a few streams. There is no reason to use multiple Stream IDs unless you need independent control over different noise sources. For example, in an agricultural model with random rainfall and crop prices, one might want to test the effect of the rainfall realization independently from the crop price realization.

The stream ID should almost always be 0 or, if nonzero, a constant or INITIAL expression.

If s is set to 0 the default noise stream will be used. The default noise stream can be controlled using the NOISE SEED variable.  

For each distinct non-zero value of s a separate noise stream will be created, with a seed related to the Stream ID.  You can couple noise streams by giving them the same stream ID.

When streams are coupled it means that the random selections will influence one another, not that they will be the same. For example, if there are two functions using the stream ID 7, adding a third with the same stream ID will change the noise generated by the first two. However, the expected statistical properties of each function will remain unchanged.


Using a dynamic (time-varying) Stream ID will degrade performance and degrade the distributional quality of the random variable.

Using many different Stream IDs (for example, one for each element of a large array of RANDOM variables) will degrade performance.