Skip to content

init_random_seed

Fabian Kindermann edited this page Apr 2, 2021 · 4 revisions
 subroutine init_random_seed(fixed)

Description:

Initializes the random seed in order to allow for the simulation of random numbers. If the random seed is not initialized, at least on some operating systems the sequence drawn with the random number generator might be identical for any call of the generator.

Optional arguments:

  • logical :: fixed
    If a logical variable fixed is passed to the subroutine that takes the value .true., the subroutine uses a fixed random seed. As a result, the sequence of random numbers drawn by the subroutine will always be the same every time your program is restarted. If fixed is not present or takes a value of .false., then the random seed is initialized at some arbitrary value that depends on the time and date at which you started your program. Hence, the series of random numbers drawn by this subroutine will be different every time your program is restarted.

References

  • Parts of this routine were copied and adapted from:
  • For further reading refer to:
    • Toral, R. & Colet, P. (2014). Stochastic Numerical Methods: An Introduction for Students and Scientists. Weinheim: Wiley.
  • This routine is used in the following programs:
    • sol_prog01_07.f90
    • sol_prog01_08.f90
Clone this wiki locally