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