dran0.f

来自「网络带宽测试工具」· F 代码 · 共 33 行

F
33
字号
      Function dran0( x1, x2 )                        Result( ran )! -----------------------------------------------------------------      Use           numerics      Use           ran_module      Implicit      None      Integer(8) :: x1, x2! -----------------------------------------------------------------! --- dran0 returns a uniform deviate in [0,1).!! --- The algorithm is loosely based on an algorithm from!     Press & Teukolsky et.al. and based on the linear congruential!     method with choices for M, A, and C that are given by!     D. Knuth in "Semi-numerical algorithms".! --- Input parameters:!     Integer  - a1, c1, m1, a2, c2, m2. The parameters of the two!                linear congruent relations used. They are passed !                via module 'ran_module'.!     Integer  - x1, x2. Seeds for the two linear congruences.!                Passed via module 'ran_module'.!! --- Output-parameters:!     Real(l_) - ran.  Uniform deviate in [0,1)! ------------------------------------------------------------------!      Real(l_)            :: ran! ------------------------------------------------------------------      x1  = Mod( a1*x1 + c1, m1 )      x2  = Mod( a2*x2 + c2, m2 )      ran = ( Real( x1, l_ ) + Real( x2, l_ )*rm2 )*rm1! -----------------------------------------------------------------      End Function dran0

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?