PSX_RAND
Generate a random number
Description:
Generate a random number.
The number is generated as the integer INUM. The maximum value that this may have is
returned as MAXNUM. Also the value of INUM divided by MAXNUM is returned as
FNUM.
Invocation
CALL PSX_RAND( INUM, MAXNUM, FNUM, STATUS )
Arguments
INUM = INTEGER (Returned)
The random (integer) number.
MAXNUM = INTEGER
(Returned)
The maximum value that INUM may have.
FNUM = REAL (Returned)
The
value INUM/MAXNUM.
STATUS = INTEGER (Given)
The global status.
Notes:
-
A seed for the random number generator may be set with PSX_SRAND.
-
The sequence of numbers generated by the operating system service that is called by this routine
is not always as random as it should be. It is probably better to use a different routine
such as one of the NAG routines. This routine is included here for completeness, though.
References
-
POSIX standard (1988), section 8.1
-
ANSI C standard (1989), section 4.10.2.1
Copyright
Copyright (C) 1991 Science & Engineering
Research Council
Copyright © 2000 Council for the Central Laboratory of the Research Councils, 2006 Particle Physics
and Astronomy Research Council