NuMFor 9f2ab49 (2024-04-08)
Numerical (Modern) Fortran. Library for Simple Numerical computing
Submodule random

This module contains routines for

Random Number generation

There are implemented random number generators using the 64-bit version of MT19937 originally coded by Takuji Nishimura and Makoto Matsumoto (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt64.html) and the Fortran translation by RĂ©mi Piatek (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/VERSIONS/FORTRAN/fortran.html)

The random number generator may be initialized with random::random_seed() and then a random number is generated:

program ex_random
use numfor, only: i8, random_seed, random_real
implicit none
call random_seed(0_i8) ! This uses the default seed
print *, random_real()
! Outputs:
! 0.78682095486780212
end program ex_random

Random Distributions

Implementations of random distributions. Currently are coded: