Article View: comp.sys.atari.st
Article #23020Re: Assembler routine that generates random numbers?
From: Michael Park
Date: Fri, 22 Jan 1993 17:01
Date: Fri, 22 Jan 1993 17:01
16 lines
1208 bytes
1208 bytes
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
Technical Details
Message-ID:
<1jp98eINNgs4@shelley.u.washington.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!srvr1.engin.umich.edu!saimiri.primate.wisc.edu!usenet.coe.montana.edu!news.u.washington.edu!stein.u.washington.edu!mparkReferences:
<1993Jan20.203516.18565@prime.mdata.fi> <727706004.2969@minster.york.ac.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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