1 real function da_gaus_noise(KDUM)
3 !---------------------------------------------------------------------
4 ! Purpose: return a normally(gaussian) distributed random variable ctions
5 ! with 0 mean and 1 standard deviation
13 ! kdum : seed for random number generator
14 ! (set to a large negative number on entry)
20 ! gauss_noise : gaussian random betwen
33 ! numerical recipes in fortran. the art of scientific computing.
34 ! second edition. cambridge university press.
35 ! press et. al., 1986.
39 ! original : 95-01(f. vandenberghe)
40 ! addition : 96-06(a. weaver)
41 !---------------------------------------------------------------------
45 integer, intent(inout) :: kdum
53 real zfac,zrsq,zv1,zv2
55 if (trace_use) call da_trace_entry("da_gaus_noise")
60 zv1 = 2.0*da_unifva(kdum) - 1.0
61 zv2 = 2.0*da_unifva(kdum) - 1.0
62 zrsq = zv1**2 + zv2**2
64 if ((zrsq>=1.0).or.(zrsq==0.0)) goto 1000
66 zfac = sqrt(-2.0*log(zrsq)/zrsq)
68 da_gaus_noise = zv2*zfac
75 if (trace_use) call da_trace_exit("da_gaus_noise")
77 end function da_gaus_noise