vendredi 28 mai 2021

Normally distributed random numbers with vsrnggaussian (Fortran)

I'm new to Fortran (gcc version 10.2.0) and try to use the subroutine 'vsrnggaussian' to generate normally distributed random numbers but always get following error:

"Error: Function 'vsrnggaussian' at (1) has no IMPLICIT type"

I don't get it since 'vsrnggaussian' is no variable that needs to be defined.

What's wrong with my code?

    program test_normaldistr_random_number
!
      USE iso_fortran_env, dp=>real64
!
      IMPLICIT NONE
!
      INTEGER :: VSL_RNG_METHOD_GAUSSIAN_BOXMULLER
      REAL(DP) :: n=1._dp, a=10._dp, sigma=2._dp, stream=1._dp
      REAL :: r = 1, status
!
      status = vsrnggaussian(VSL_RNG_METHOD_GAUSSIAN_BOXMULLER,
     &stream, n, r, a, sigma)
!
      print *, status
!
      end program



Aucun commentaire:

Enregistrer un commentaire