LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
complex*16 function zlarnd ( integer  IDIST,
integer, dimension( 4 )  ISEED 
)

ZLARND

Purpose:
 ZLARND returns a random complex number from a uniform or normal
 distribution.
Parameters
[in]IDIST
          IDIST is INTEGER
          Specifies the distribution of the random numbers:
          = 1:  real and imaginary parts each uniform (0,1)
          = 2:  real and imaginary parts each uniform (-1,1)
          = 3:  real and imaginary parts each normal (0,1)
          = 4:  uniformly distributed on the disc abs(z) <= 1
          = 5:  uniformly distributed on the circle abs(z) = 1
[in,out]ISEED
          ISEED is INTEGER array, dimension (4)
          On entry, the seed of the random number generator; the array
          elements must be between 0 and 4095, and ISEED(4) must be
          odd.
          On exit, the seed is updated.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011
Further Details:
  This routine calls the auxiliary routine DLARAN to generate a random
  real number from a uniform (0,1) distribution. The Box-Muller method
  is used to transform numbers from a uniform to a normal distribution.

Definition at line 77 of file zlarnd.f.

77 *
78 * -- LAPACK auxiliary routine (version 3.4.0) --
79 * -- LAPACK is a software package provided by Univ. of Tennessee, --
80 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
81 * November 2011
82 *
83 * .. Scalar Arguments ..
84  INTEGER idist
85 * ..
86 * .. Array Arguments ..
87  INTEGER iseed( 4 )
88 * ..
89 *
90 * =====================================================================
91 *
92 * .. Parameters ..
93  DOUBLE PRECISION zero, one, two
94  parameter ( zero = 0.0d+0, one = 1.0d+0, two = 2.0d+0 )
95  DOUBLE PRECISION twopi
96  parameter ( twopi = 6.2831853071795864769252867663d+0 )
97 * ..
98 * .. Local Scalars ..
99  DOUBLE PRECISION t1, t2
100 * ..
101 * .. External Functions ..
102  DOUBLE PRECISION dlaran
103  EXTERNAL dlaran
104 * ..
105 * .. Intrinsic Functions ..
106  INTRINSIC dcmplx, exp, log, sqrt
107 * ..
108 * .. Executable Statements ..
109 *
110 * Generate a pair of real random numbers from a uniform (0,1)
111 * distribution
112 *
113  t1 = dlaran( iseed )
114  t2 = dlaran( iseed )
115 *
116  IF( idist.EQ.1 ) THEN
117 *
118 * real and imaginary parts each uniform (0,1)
119 *
120  zlarnd = dcmplx( t1, t2 )
121  ELSE IF( idist.EQ.2 ) THEN
122 *
123 * real and imaginary parts each uniform (-1,1)
124 *
125  zlarnd = dcmplx( two*t1-one, two*t2-one )
126  ELSE IF( idist.EQ.3 ) THEN
127 *
128 * real and imaginary parts each normal (0,1)
129 *
130  zlarnd = sqrt( -two*log( t1 ) )*exp( dcmplx( zero, twopi*t2 ) )
131  ELSE IF( idist.EQ.4 ) THEN
132 *
133 * uniform distribution on the unit disc abs(z) <= 1
134 *
135  zlarnd = sqrt( t1 )*exp( dcmplx( zero, twopi*t2 ) )
136  ELSE IF( idist.EQ.5 ) THEN
137 *
138 * uniform distribution on the unit circle abs(z) = 1
139 *
140  zlarnd = exp( dcmplx( zero, twopi*t2 ) )
141  END IF
142  RETURN
143 *
144 * End of ZLARND
145 *
double precision function dlaran(ISEED)
DLARAN
Definition: dlaran.f:69
complex *16 function zlarnd(IDIST, ISEED)
ZLARND
Definition: zlarnd.f:77