NuMFor 9f2ab49 (2024-04-08)
Numerical (Modern) Fortran. Library for Simple Numerical computing
random_exponential Interface Reference

Fills a scalar or array with random numbers following an exponential distribution. More...

Detailed Description

Fills a scalar or array with random numbers following an exponential distribution.

The general signature is call random_exponential(mu, x) where x may be a scalar, or vector (1D array), matrix (2D array), 3D-array, 4D-array, or 5D-array.

The following uses are valid.

USE numfor, only: random_exponential
real(dp) :: x
real(dp), dimension(2,3,3) :: xx
call random_exponential(mu, x) ! Valid.
call random_exponential(mu, xx) ! Valid.
!

Example:

program test_rand_expon
use numfor, only: dp, zero, str, random_seed, random_exponential
implicit none
real(dp), dimension(2, 3) :: samples
call random_seed(0) ! Uses default seed
call random_exponential(2._dp, samples)
print "(A)", str(samples)
! Outputs:
! [[ 3.0912457577868, 0.5766454637618]
! [ 2.4803832429473, 5.8624300413216]
! [ 0.0389183312912, 1.0380588489303]]
end program test_rand_expon

The documentation for this interface was generated from the following file: