96 SUBROUTINE slarnv( IDIST, ISEED, N, X )
114 parameter( one = 1.0e+0, two = 2.0e+0 )
116 parameter( lv = 128 )
118 parameter( twopi = 6.28318530717958647692528676655900576839e+0 )
121 INTEGER I, IL, IL2, IV
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 slaruv( 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 slarnv(idist, iseed, n, x)
SLARNV returns a vector of random numbers from a uniform or normal distribution.
subroutine slaruv(iseed, n, x)
SLARUV returns a vector of n random real numbers from a uniform distribution.