Contents - Index
The Random function can have two or three arguments. The usual application provides two parameters, so that Random(a,b) returns a uniformly distributed random number X such that a <=X<=b. (Note that the RandG function returns a random number from a Gaussian distribution.) Each new solving process will result in a different random number.
The optional third parameter has the following effects.
a) If the parameter is zero, than the Random function operates exactly as it would with two parameters.
b) If the parameter is greater than zero, it is used to generated a seed for the random number generator routines. In this case, the random number generator will always return the same value if a constant value is provided for the seed, e.g., Random(0,5,99)
c) if the parameter is less than zero, than a random number will be chosen when an EES file is opened and it will remain unchanged as the problem is repeatedly solved. However, a new random number will be chosen when a file is opened or when EES is restarted. This option makes it possible to create 'quiz' problems with randomized inputs.
Used within Functions and/or Procedures and the Repeat Until or other logical expressions, the Random function can be used to implement Monte Carlo type calculations.
See also: RandG