Intrinsic-1 Ran

Top  Previous  Next

1: variable:= Ran(value);

 

This intrinsic returns a random number between zero and the argument minus one. An argument of zero initializes the random number generator to produce a repeatable sequence. Negative arguments randomize the random generator to begin a new sequence. For example:

 

       X:= Ran(100);                \Range is 0 through 99

       X:= Ran(0);                \Resets seed for a repeatable sequence

       X:= Ran(-4);                \Randomizes then returns Ran(4)