98 SUBROUTINE clarnv( IDIST, ISEED, N, X )
116 parameter( zero = 0.0e+0, one = 1.0e+0, two = 2.0e+0 )
118 parameter( lv = 128 )
120 parameter( twopi = 6.28318530717958647692528676655900576839e+0 )
129 INTRINSIC cmplx, exp, log, min, sqrt
136 DO 60 iv = 1, n, lv / 2
137 il = min( lv / 2, n-iv+1 )
142 CALL slaruv( iseed, 2*il, u )
144 IF( idist.EQ.1 )
THEN
149 x( iv+i-1 ) = cmplx( u( 2*i-1 ), u( 2*i ) )
151 ELSE IF( idist.EQ.2 )
THEN
156 x( iv+i-1 ) = cmplx( two*u( 2*i-1 )-one,
159 ELSE IF( idist.EQ.3 )
THEN
164 x( iv+i-1 ) = sqrt( -two*log( u( 2*i-1 ) ) )*
165 $ exp( cmplx( zero, twopi*u( 2*i ) ) )
167 ELSE IF( idist.EQ.4 )
THEN
173 x( iv+i-1 ) = sqrt( u( 2*i-1 ) )*
174 $ exp( cmplx( zero, twopi*u( 2*i ) ) )
176 ELSE IF( idist.EQ.5 )
THEN
182 x( iv+i-1 ) = exp( cmplx( zero, twopi*u( 2*i ) ) )
subroutine clarnv(idist, iseed, n, x)
CLARNV 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.