home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Du Jour
/
SoftwareDuJour.iso
/
BUSINESS
/
DBASE
/
CLIPUDF.ARC
/
RAND.PRG
< prev
next >
Wrap
Text File
|
1986-02-04
|
512b
|
17 lines
* 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))