Im trying to call a sequence of random numbers created by a function called RANF() as seen below.
The problem is that I get the same number (1.0) when using the code below and im wondering why:
program LOOP
INTEGER(KIND=8) :: i
REAL(KIND=8) :: RANF
do i=1,20
number = RANF()
PRINT*,nymber
enddo
end program
FUNCTION RANF()
DATA IA/16807/,IC/2147483647/,IQ/127773/,IR/2836/
COMMON /CSEED/ ISEED
IH = ISEED/IQ
IL = MOD(ISEED,IQ)
IT = IA*IL-IR*IH
IF(IT.GT.0) THEN
ISEED = IT
ELSE
ISEED = IC+IT
END IF
RANF = ISEED/FLOAT(IC)
RETURN
END FUNCTION
The problem is that I get the same number (1.0) when using the code below and im wondering why:
program LOOP
INTEGER(KIND=8) :: i
REAL(KIND=8) :: RANF
do i=1,20
number = RANF()
PRINT*,nymber
enddo
end program
FUNCTION RANF()
DATA IA/16807/,IC/2147483647/,IQ/127773/,IR/2836/
COMMON /CSEED/ ISEED
IH = ISEED/IQ
IL = MOD(ISEED,IQ)
IT = IA*IL-IR*IH
IF(IT.GT.0) THEN
ISEED = IT
ELSE
ISEED = IC+IT
END IF
RANF = ISEED/FLOAT(IC)
RETURN
END FUNCTION