General

General

Random number generation from a CFX User Fortran routine.

    • FAQFAQ
      Participant

      Neither RAND nor RANDOM are part of the Fortran standard, instead they are system dependent implementations specific to the system libraries in use, so are a dangerous choice if cross platform operation is required. A better choice is a system independent way of generating random numbers, for example the CFX Solver’s built in random number generation routine GET_RANDOM which is called as follows: CALL GET_RANDOM (RAND,NRAND,ISEED) This generates an array random numbers, where: RAND(NRAND) is a REAL array to contain the random numbers NRAND is the number of random numbers to be generated. ISEED is the random seed. If ISEED is greater than zero, then random number generation will be seeded, using ISEED. So, for unseeded random number generation, ISEED would be declared as an INTEGER and initialised to zero, prior to the call to GET_RANDOM.