randn2d Function

private function randn2d(m, n) result(r)

Generates m x n random numbers with a normal distribution.

Arguments

Type IntentOptional AttributesName
integer(kind=ik), intent(in) :: m
integer(kind=ik), intent(in) :: n

Return Value real(kind=rk) (m,n)


Called by

proc~~randn2d~~CalledByGraph proc~randn2d randn2d interface~randn randn interface~randn->proc~randn2d proc~constructor constructor proc~constructor->interface~randn interface~layer_type layer_type interface~layer_type->proc~constructor

Contents

Source Code


Source Code

  function randn2d(m, n) result(r)
    !! Generates m x n random numbers with a normal distribution.
    integer(ik), intent(in) :: m, n
    real(rk) :: r(m, n), r2(m, n)
    call random_number(r)
    call random_number(r2)
    r = sqrt(-2 * log(r)) * cos(2 * pi * r2)
  end function randn2d