HP Fortran Programmer's Reference (September 2007)

Intrinsic procedures
Intrinsic procedure specifications
Chapter 11 609
NOTE To ensure different random values for each run of a program, ISEED should be
set to a different value each time the program is run. One way to implement
this would be to have the user enter the seed at the start of the program.
Another way would be to compute a value from the current year, day, and
month (returned by IDATE) and the number of seconds since midnight
(returned by SECNDS).
RAND()
Description
Generate successive pseudorandom numbers uniformly distributed in the range of 0.0 to 1.0.
Class
Elemental nonstandard function.
Result type/
type parameters
REAL(4) type.
NOTE For details about restarting the pseudorandom number generator used by
IRAND and RAND, see “SRAND(ISEED)” on page 627 section.
RANDOM_NUMBER(HARVEST)
Description
Returns one pseudorandom number or an array of pseudorandom numbers from the uniform
distribution over the range 0 <=
x
< 1.
Class
Subroutine.