98 SUBROUTINE dlarnv( IDIST, ISEED, N, X )
110 DOUBLE PRECISION X( * )
116 DOUBLE PRECISION ONE, TWO
117 parameter ( one = 1.0d+0, two = 2.0d+0 )
119 parameter ( lv = 128 )
120 DOUBLE PRECISION TWOPI
121 parameter ( twopi = 6.2831853071795864769252867663d+0 )
124 INTEGER I, IL, IL2, IV
127 DOUBLE PRECISION U( lv )
130 INTRINSIC cos, log, min, sqrt
137 DO 40 iv = 1, n, lv / 2
138 il = min( lv / 2, n-iv+1 )
139 IF( idist.EQ.3 )
THEN
148 CALL dlaruv( iseed, il2, u )
150 IF( idist.EQ.1 )
THEN
157 ELSE IF( idist.EQ.2 )
THEN
162 x( iv+i-1 ) = two*u( i ) - one
164 ELSE IF( idist.EQ.3 )
THEN
169 x( iv+i-1 ) = sqrt( -two*log( u( 2*i-1 ) ) )*
170 $ cos( twopi*u( 2*i ) )
subroutine dlaruv(ISEED, N, X)
DLARUV returns a vector of n random real numbers from a uniform distribution.
subroutine dlarnv(IDIST, ISEED, N, X)
DLARNV returns a vector of random numbers from a uniform or normal distribution.