Article View: comp.sys.transputer
Article #1771OCCAM2 Random number generator
From: Luiz Felipe Perrone
Date: Fri, 24 May 1991 20:30
Date: Fri, 24 May 1991 20:30
23 lines
1770 bytes
1770 bytes
In response to Jason's question about TDS2 random number generator:
The RAND function in TDS2 requires one INT parameter that it uses
as the seed for its linear congruential algorithm and returns two values:
one of INT type and one of REAL32 type. The INT result can be used as
a random INT, but its true purpose is to serve as seed for the next call
to RAND. The REAL32 value is the real numeric value that results from the
RAND function.
I have used the INT.value as a random number in a simulation program some
time ago where I needed to choose a random number between 0 and 3 (therefore
I had to use INT.value REM 4) and must tell you that I wasn't very much pleased
with the results. The result clearly showed a tendency to be non-uniformly
distributed. I'm not sure this resulted from the characteristics of the
algorithm used in RAND or from my attempt to limit the range of the random
number produced. If someone can explain this behaviour, please send me a note.
------------------------------------------------------------------------
Luiz Felipe Perrone
MSc student - COPPE - Dept. of Systems Engineering and Computer Science
Universidade Federal do Rio de Janeiro
E-mail: COS99284@UFRJ (BITNET)
------------------------------------------------------------------------
Technical Details
Message-ID:
<9105241956.AA11915@theory.TC.CORNELL.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!spool.mu.edu!agate!ucbvax!UFRJ.BITNET!COS99284Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!spool.mu.edu!agate!ucbvax!UFRJ.BITNET!COS99284 From: COS99284@UFRJ.BITNET (Luiz Felipe Perrone) Newsgroups: comp.sys.transputer Subject: OCCAM2 Random number generator Message-ID: <9105241956.AA11915@theory.TC.CORNELL.EDU> Date: 24 May 91 20:30:46 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 23 X-Unparsable-Date: Mon, 20 May 91 15:44:23 BRA