7 #include "sll_memory.h"
8 #include "sll_working_precision.h"
30 sll_real64 :: rsq, v(2)
32 logical,
save :: g_stored = .false.
40 v(1) = 2._f64*v(1) - 1._f64
41 v(2) = 2._f64*v(2) - 1._f64
42 rsq = v(1)*v(1) + v(2)*v(2)
43 if (rsq < 1._f64)
exit
45 rsq = sqrt(-2._f64*log(rsq)/rsq)
58 sll_real64,
intent(out) :: res(1:2)
59 sll_real64 :: rsq, v1, v2
62 call random_number(v1)
63 call random_number(v2)
64 v1 = 2._f64*v1 - 1._f64
65 v2 = 2._f64*v2 - 1._f64
67 if (rsq > 0._f64 .and. rsq < 1._f64)
exit
69 rsq = sqrt(-2._f64*log(rsq)/rsq)
sll_m_gaussian random generator
real(kind=f64) function, public sll_f_gaussian_deviate()
Returns a value of a random variable in ONE dimension following the Gaussian probability density with...
subroutine, public sll_s_gaussian_deviate_2d(res)
Returns a value of a random variable in TWO dimensions following the Gaussian probability density wit...