12.07.2015 Views

Intel® Fortran Libraries Reference

Intel® Fortran Libraries Reference

Intel® Fortran Libraries Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Descriptions of the Library Routines 2IRANGETiflag(Input) INTEGER(4). Optional for IRAND. Controls the way the returned random number ischosen. If iflag is omitted, it is assumed to be 0, and the return range is 0 through (2**15)–1(inclusive).Results:The result type is INTEGER(4). If iflag is 1, the generator is restarted and the first random value isreturned. If iflag is 0, the next random number in the sequence is returned. If iflag is neither zeronor 1, it is used as a new seed for the random number generator, and the functions return the firstnew random value.IRAND and IRANDM are equivalent and return the same random numbers. Both functions areincluded to ensure portability of existing code that references one or both of them.You can use SRAND to restart the pseudorandom number generator used by these functions.CompatibilityCONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIBSee Also: “SRAND”, the RANDOM_NUMBER and RANDOM_SEED intrinsic routines in theLanguage <strong>Reference</strong>ExampleUSE IFPORTINTEGER(4) istat, flag_value, r_nums(20)flag_value=1r_nums(1) = IRAND (flag_value)flag_value=0do istat=2,20r_nums(istat) = irand(flag_value)end doPortability Subroutine: Returns the current seed.Module: USE IFPORTSyntaxCALL IRANGET (seed)seed(Output) INTEGER(4). The current seed value.2-185

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

Saved successfully!

Ooh no, something went wrong!