FORTRAN RAND Function
Keith Bierman fpgroup
khb at chiba.Eng.Sun.COM
Thu Jan 17 20:23:47 AEST 1991
In article <1991Jan17.063559.2704 at noose.ecn.purdue.edu> paithan at amide.ecn.purdue.edu (Dilip Paithankar) writes:
------
PROGRAM RANDOM
C Program to generate 25 random numbers.
INTEGER ISEED
DOUBLE PRECISION X
DO 10 J = 1, 25
CALL SRAND(ISEED)
X = RAND ()
WRITE (*,'(1X,''X IS '',G14.6)') X
10 CONTINUE
STOP
END
------
Do you really, really want to reinitalize the random number generator
every time through the loop ? As long as you provide the same ISEED, I
would expect rand() to produce the same result (whatever it might
happen to be).
In addition, it is usually poor form to use (reference) a variable
before it is defined .... which would appear to be the case for ISEED.
I don't have my SGI docs handy, so I don't know off-hand if proper
usage is ala Sun. If so, it should be rand(iflag) where iflag is 1,0,
or a seed.
btw: unix rand isn't a very good random number generator, in case
that happens to matter...
cheers
--
----------------------------------------------------------------
Keith H. Bierman kbierman at Eng.Sun.COM | khb at chiba.Eng.Sun.COM
SMI 2550 Garcia 12-33 | (415 336 2648)
Mountain View, CA 94043
More information about the Comp.sys.sgi
mailing list