[Fortran] 纯文本查看 复制代码 Module ran001
Implicit None
Save
Integer :: n = 9876
End Module ran001
!-------------------------------------------------------------
Subroutine random0(ran)
Use ran001
Implicit None
Real, Intent(out) :: ran
n = Mod(8121 * n + 28411, 134456) ! A number between 0 and 134455
ran = real(n) / 134456. ! Generate a number [0,1.)
End Subroutine random0
!-------------------------------------------------------------
Subroutine seed(iseed)
Use ran001
Implicit None
Integer, Intent(in) :: iseed
n = abs(iseed)
End Subroutine seed
|