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

  1. * Function...RAND() function
  2. * Syntax.....RAND(expN)
  3. * Parameters.A numeric expression that evaluates to an integer.
  4. * Returns....An integer in the range of 0 to n-1.
  5. * Notes......Requires that a memory variable called "seed" be
  6. *            initialized to a value between 0 and 1 before calling.
  7. *            For example:
  8. *               seed = VAL(SUBSTR(TIME(),8,1)) * .1
  9.  
  10. FUNCTION RAND
  11. PARAM n
  12.  
  13. seed = 997 * seed
  14. seed = seed - INT(seed)
  15.  
  16. RETURN (INT(n * seed))
  17.