* Function...RAND() function
* Syntax.....RAND(expN)
* Parameters.A numeric expression that evaluates to an integer.
* Returns....An integer in the range of 0 to n-1.
* Notes......Requires that a memory variable called "seed" be
* initialized to a value between 0 and 1 before calling
* For example:
* seed = VAL(SUBSTR(TIME(),8,1)) * .1
FUNCTION RAND
PARAM n
seed = 997 * seed
seed = seed - INT(seed)
RETURN (INT(n * seed))