Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer | :: | k |
function random_n(k)
!**** PURPOSE: THIS FUNCTION PROVIDES RANDOM NUMBERS RANGING FROM 0. TO 1.
!**** CALLED IN: GAMMAD, INIT, READSUB
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! PARAMETERS & VARIABLES
!
! >>>>> STATIC
! i = local par
! >>>>>
!calc randn
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
integer i, k
real(dp) random_n
dimension k(4)
k(4) = 3 * k(4) + k(2)
k(3) = 3 * k(3) + k(1)
k(2) = 3 * k(2)
k(1) = 3 * k(1)
i = k(1) / 1000
k(1) = k(1) - i * 1000
k(2) = k(2) + i
i = k(2) / 100
k(2) = k(2) - 100 * i
k(3) = k(3) + i
i = k(3) / 1000
k(3) = k(3) - i * 1000
k(4) = k(4) + i
i = k(4) / 100
k(4) = k(4) - 100 * i
random_n = (((float(k(1)) * .001 + float(k(2))) * .01 + float(k(3))) * .001 + &
float(k(4))) * .01
return
end function random_n