Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!hellgate.utah.edu!hamblin.math.byu.edu!sol.ctr.columbia.edu!lll-winken!uunet!ogicse!milton!seymour From: seymour@milton.u.washington.edu (Richard Seymour) Newsgroups: comp.lang.fortran Subject: Re: randu? Message-ID: <17397@milton.u.washington.edu> Date: 28 Feb 91 21:10:43 GMT References: <62349@eerie.acsu.Buffalo.EDU> Organization: University of Washington, Seattle Lines: 28 What about RANDU? " brackets> source: vax fortran user's guide, aa-d035c-te, for vms v3.0, fort v3.0) page D-12 "Compatibility: VAX-11 Fortran and PDP-11 Fortran" D.3.9 RANDU subroutine The RANDU subroutine computes a pseudorandom numvber as a single-precision value uniformly distributed in the range: 0.0 .LE. value .LT. 1.0 a call to randu has the form: CALL RANDU (i1,i2,x) where: i1, i2 are INTEGER*2 variables or array elements that contain the seed for computing the random number x is a real variable or array element where the computed random number is stored. notes: 1) the values of i1 and i2 are updated during the computation 2) the algorithm is: if I1=I2=0 set generator base: x(n+1)=2**16+3 otherwise: x(n+1)=(2**16+3)*x(n) mod 2**32 store generator base x(n=1) in i1,i2 result is x(n+1) scaled to a real value y(n=1) for 0.0 .LE. y(n=1) .LT. 1.0