96 SUBROUTINE zlarnv( IDIST, ISEED, N, X )
113 DOUBLE PRECISION ZERO, ONE, TWO
114 parameter( zero = 0.0d+0, one = 1.0d+0, two = 2.0d+0 )
116 parameter( lv = 128 )
117 DOUBLE PRECISION TWOPI
118 parameter( twopi = 6.28318530717958647692528676655900576839d+0 )
124 DOUBLE PRECISION U( LV )
127 INTRINSIC dcmplx, exp, log, min, sqrt
134 DO 60 iv = 1, n, lv / 2
135 il = min( lv / 2, n-iv+1 )
140 CALL dlaruv( iseed, 2*il, u )
142 IF( idist.EQ.1 )
THEN
147 x( iv+i-1 ) = dcmplx( u( 2*i-1 ), u( 2*i ) )
149 ELSE IF( idist.EQ.2 )
THEN
154 x( iv+i-1 ) = dcmplx( two*u( 2*i-1 )-one,
157 ELSE IF( idist.EQ.3 )
THEN
162 x( iv+i-1 ) = sqrt( -two*log( u( 2*i-1 ) ) )*
163 $ exp( dcmplx( zero, twopi*u( 2*i ) ) )
165 ELSE IF( idist.EQ.4 )
THEN
171 x( iv+i-1 ) = sqrt( u( 2*i-1 ) )*
172 $ exp( dcmplx( zero, twopi*u( 2*i ) ) )
174 ELSE IF( idist.EQ.5 )
THEN
180 x( iv+i-1 ) = exp( dcmplx( zero, twopi*u( 2*i ) ) )
subroutine zlarnv(idist, iseed, n, x)
ZLARNV 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.