7 integer, public, parameter :: GNDP = kind(1.0d0)
9 real(kind = GNDP), save :: &
10 gnc = 362436.0 / 16777216.0, &
11 gncd = 7654321.0 / 16777216.0, &
12 gncm = 16777213.0 / 16777216.0
17 real(kind = GNDP), save :: gnu(97)
20 subroutine gn_fatal(message)
21 character(len = *), intent(in) :: message
24 end subroutine gn_fatal
26 function gn_monte_rand(min, max) result(monte)
27 real(kind = GNDP), intent(in) :: min
28 real(kind = GNDP), intent(in) :: max
29 real(kind = GNDP) :: monte
34 call gn_fatal('gn_monte_rand: min > max')
35 else if (min == max) then
36 call gn_fatal('gn_monte_rand: min = max: returning min')
40 monte_temp = gnu(gni97) - gnu(gnj97)
41 if (monte_temp < 0.0) then
42 monte_temp = monte_temp + 1.0
45 gnu(gni97) = monte_temp
52 monte = min + monte_temp * (max - min)
54 end function gn_monte_rand
56 end module general_rand
58 ! { dg-final { cleanup-modules "general_rand" } }