100 SUBROUTINE clarnv( IDIST, ISEED, N, X )
119 parameter ( zero = 0.0e+0, one = 1.0e+0, two = 2.0e+0 )
121 parameter ( lv = 128 )
123 parameter ( twopi = 6.2831853071795864769252867663e+0 )
132 INTRINSIC cmplx, exp, log, min, sqrt
139 DO 60 iv = 1, n, lv / 2
140 il = min( lv / 2, n-iv+1 )
145 CALL slaruv( iseed, 2*il, u )
147 IF( idist.EQ.1 )
THEN
152 x( iv+i-1 ) = cmplx( u( 2*i-1 ), u( 2*i ) )
154 ELSE IF( idist.EQ.2 )
THEN
159 x( iv+i-1 ) = cmplx( two*u( 2*i-1 )-one,
162 ELSE IF( idist.EQ.3 )
THEN
167 x( iv+i-1 ) = sqrt( -two*log( u( 2*i-1 ) ) )*
168 $ exp( cmplx( zero, twopi*u( 2*i ) ) )
170 ELSE IF( idist.EQ.4 )
THEN
176 x( iv+i-1 ) = sqrt( u( 2*i-1 ) )*
177 $ exp( cmplx( zero, twopi*u( 2*i ) ) )
179 ELSE IF( idist.EQ.5 )
THEN
185 x( iv+i-1 ) = exp( cmplx( zero, twopi*u( 2*i ) ) )
subroutine slaruv(ISEED, N, X)
SLARUV returns a vector of n random real numbers from a uniform distribution.
subroutine clarnv(IDIST, ISEED, N, X)
CLARNV returns a vector of random numbers from a uniform or normal distribution.