home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / atari / st / 20866 < prev    next >
Encoding:
Internet Message Format  |  1993-01-22  |  1.2 KB

  1. Xref: sparky comp.sys.atari.st:20866 comp.sys.atari.st.tech:6800
  2. Path: sparky!uunet!srvr1.engin.umich.edu!saimiri.primate.wisc.edu!usenet.coe.montana.edu!news.u.washington.edu!stein.u.washington.edu!mpark
  3. From: mpark@stein.u.washington.edu (Michael Park)
  4. Newsgroups: comp.sys.atari.st,comp.sys.atari.st.tech
  5. Subject: Re: Assembler routine that generates random numbers?
  6. Date: 22 Jan 1993 17:01:02 GMT
  7. Organization: University of Washington
  8. Lines: 16
  9. Message-ID: <1jp98eINNgs4@shelley.u.washington.edu>
  10. References: <1993Jan20.203516.18565@prime.mdata.fi> <727706004.2969@minster.york.ac.uk>
  11. NNTP-Posting-Host: stein.u.washington.edu
  12.  
  13. mjl-b@minster.york.ac.uk writes:
  14. [about random numbers...]
  15.  
  16. >The XBIOS call uses the "linear congruential" method of generating pseudo-
  17. >random numbers, which works as follows:
  18. >
  19. >R(n+1) := [R(n) * a] mod b
  20.                       ^^^
  21.    The "linear congruential" method typically involves an addition as well as
  22. a multiplication (using modular arithmetic).
  23.    My docs say that R(n+1) = [R(n) * a] + b using fixed-length (presumably
  24. long) operations to make everything mod 2^32 or whatever.  FYI, a = 3141592621
  25. and b = 1.  In addition, the OS call returns R(n+1)>>8, which gives a
  26. 24-bit pseudorandom number.
  27.  
  28. --m
  29.