home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a067 / 1.img / GRUMP501.EXE / RAND.PRG < prev    next >
Encoding:
Text File  |  1991-04-23  |  636 b   |  23 lines

  1. /*
  2.     Program: GFRAND()
  3.     System:  GRUMPFISH LIBRARY
  4.     Author:  Greg Lief and Jeff Wilson
  5.     Copyright (c) 1988-90, Greg Lief
  6.     Clipper 5.x Version
  7.     Compile instructions: clipper blank3 /n/w/a
  8.  
  9.     Random number generator - returns an integer in the range of 0 to N-1
  10. */
  11. function GFRand(n)
  12. static xrndseed := .123456789
  13. if xrndseed = .123456789
  14.    xrndseed += val(substr(time(), 7, 2)) / 100
  15. endif
  16. xrndseed := (xrndseed * 31415821 + 1) / 1000000
  17. return int( (xrndseed -= int(xrndseed)) * n)
  18.  
  19. * end function GFRand()
  20. *--------------------------------------------------------------------*
  21.  
  22. * eof rand.prg
  23.