Random, RandomNormal

 

Description

Returns a given number in a pseudorandom sequence.

Type

NUMERIC

Arguments

Type

Meaning

1

NUMERIC

a numeric value which is rounded down to an integer and used to identify a unique sequence of numbers -- calls with the same integral

seed refer to the same random sequence of numbers.

2

NUMERIC

a numeric value which is rounded down to an integer and denotes the one-based index into the random sequence of the value to be returned.

3

NUMERIC

a number which is ignored except that the units are taken as the units to be returned.

Evaluation

Random returns a number from a random sequence of numbers uniformly distributed in the range [0, 1.0].

RandomNormal returns a number from a random sequence of numbers whose distribution is normal with a mean of 0 and a standard deviation of 1.

The unique sequence of numbers associated with each integral seed is the same on all platforms supported by RiverWare, allowing for repeatable results.

The sequences are generated using the linear congruential method described

in Park and Miller (1988) Communication of the ACM, vol 31, pages 1192-1201.

Note: random number generators such as this are often referred to as "pseudo-random" because they are not the result of an intrinsically

random process, are in fact predictably determined by the seed.

Comments

The time to evaluate a call to either of these functions is proportional to the magnitude of the index argument (because the entire sequence must be generated at least once per RiverWare execution). Thus, if performance is an important issue, one should choose to get numbers from the earlier portion of a sequence.

 
RandomNormal(1.0, 1.0, 1.0)
RandomNormal(1.0, 3.0, 0.0)
 

Refer to the sequence: 0.09151046 0.33494915 -1.421276 -1.24931121 ...

Thus, the first call returns the first number in the sequence ( 0.09151046) and the second call returns the third number in the sequence (0.33494915).