96 SUBROUTINE dlarnv( IDIST, ISEED, N, X )
107 DOUBLE PRECISION X( * )
113 DOUBLE PRECISION ONE, TWO
114 parameter( one = 1.0d+0, two = 2.0d+0 )
116 parameter( lv = 128 )
117 DOUBLE PRECISION TWOPI
118 parameter( twopi = 6.28318530717958647692528676655900576839d+0 )
121 INTEGER I, IL, IL2, IV
124 DOUBLE PRECISION U( LV )
127 INTRINSIC cos, log, min, sqrt
134 DO 40 iv = 1, n, lv / 2
135 il = min( lv / 2, n-iv+1 )
136 IF( idist.EQ.3 )
THEN
145 CALL dlaruv( iseed, il2, u )
147 IF( idist.EQ.1 )
THEN
154 ELSE IF( idist.EQ.2 )
THEN
159 x( iv+i-1 ) = two*u( i ) - one
161 ELSE IF( idist.EQ.3 )
THEN
166 x( iv+i-1 ) = sqrt( -two*log( u( 2*i-1 ) ) )*
167 $ cos( twopi*u( 2*i ) )
subroutine dlarnv(idist, iseed, n, x)
DLARNV returns a vector of random numbers from a uniform or normal distribution.
subroutine dlaruv(iseed, n, x)
DLARUV returns a vector of n random real numbers from a uniform distribution.