RandomInteger

Syntax

RandomInteger
RandomInteger(UpperBound)
RandomInteger(LowerBound, UpperBound)
RandomInteger(LowerBound, UpperBound, Seed)

Description

Returns a different random integer, between LowerBound and UpperBound, for each timestep.  If not specified, the lower and upper bounds default to 0 and 1.  The value is a integer -- to get random real numbers, use the Random function.

The value returned is a random but repeatable value for any given branch, scenario, year and month.  This means that the numbers will be the same each time a scenario is calculated (for a given branch, year and timestep).  If you want the same sequence for two or more branches or scenarios, you can use the "Seed" parameter. Using the same seed in two different functions will yield the same sequence.  Note: The seed value is not the first value in the sequence.

Example

RandomInteger = either 0 or 1
RandomInteger(100) = some integer between 0 and 100, e.g., 83
RandomInteger(-10, 10) = some integer between -10 and 10, e.g., -5
RandomInteger(0, 100, 5) = some integer between 0 and 100 using a seed of 5, e.g., 15.  This will produce the same sequence regardless in which branch or scenario it is used.