Like G05CAF, PDA_RAND has a dummy argument demanded by the Fortran
standard. It is convenient to set it to zero. Here is an example
where two random numbers are drawn from a uniform distribution
between 0 and 1. In this example a fixed seed is used, but you
could use the computer's clock to create a random seed (see
Section
).
INTEGER SEED
EXTERNAL PDA_RAND
REAL PDA_RAND, VALUES( 2 )
* Use a fixed seed of 1.
SEED = 1
CALL PDA_RNSED( SEED )
* Obtain two random numbers from a uniform distribution between 0
* and 1.
VALUE( 1 ) = PDA_RAND( 0.0 )
VALUE( 2 ) = PDA_RAND( 0.0 )
The EXTERNAL statement is recommended, although in many cases it
will be unnecessary. To obtain in the range [
,
] as
provided by G05DAF, merely apply the following relationship.
PDA [1ex