12.07.2015 Views

Intel® Fortran Libraries Reference

Intel® Fortran Libraries Reference

Intel® Fortran Libraries Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Descriptions of the Library Routines 2ranval = random(0) ! get next random numberprint *,ranvalendRANDOMPortability Subroutine: Returns a pseudorandom number greater than or equal to zero and lessthan one from the uniform distribution.Module: USE IFPORTSyntaxCALL RANDOM (ranval)ranval(Output) REAL(4). Pseudorandom number, 0 ≤ ranval < 1, from the uniform distribution.A given seed always produces the same sequence of values from RANDOM.If SEED is not called before the first call to RANDOM, RANDOM begins with a seed value ofone. If a program must have a different pseudorandom sequence each time it runs, pass theconstant RND$TIMESEED (defined in IFQWIN.F90) to SEED before the first call toRANDOM.The portability routines DRAND, DRANDM, IRAND, IRANDM, RAN, RAND, and theRANDOM portability function and subroutine use the same algorithms and thus return the sameanswers. They are all compatible and can be used interchangeably. The algorithm used is a "PrimeModulus M Multiplicative Linear Congruential Generator," a modified version of the randomnumber generator by Park and Miller in "Random Number Generators: Good Ones Are Hard toFind," CACM, October 1988, Vol. 31, No. 10.CompatibilityCONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIBSee Also: “SEED”, “DRAND, DRANDM”, “IRAND, IRANDM”, “RAND, RANDOM”, theRANDOM_NUMBER intrinsic subroutine in the Language <strong>Reference</strong>ExampleUSE IFPORTREAL(4) ranCALL SEED(1995)CALL RANDOM(ran)See also the second example in “RAND, RANDOM”, which shows how to use both theRANDOM function and the RANDOM subroutine.2-367

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!