Click or drag to resize
RandomNextCauchy Method
Generates a pseudorandom number from a Cauchy distribution.

Namespace: Imsl.Stat
Assembly: ImslCS (in ImslCS.dll) Version: 6.5.2.0
Syntax
public virtual double NextCauchy()

Return Value

Type: Double
A double which specifies a pseudorandom number from a Cauchy distribution.
Remarks
The probability density function is

f\left( x \right) = \frac{1}{\pi 
            (1 + x^2)}

Use of the inverse CDF technique would yield a Cauchy deviate from a uniform (0, 1) deviate, u, as \tan \left[ {\pi 
            \left( {u - .5} \right)}\right]. Rather than evaluating a tangent directly, however, NextCauchy generates two uniform (-1, 1) deviates, x_1 and x_2. These values can be thought of as sine and cosine values. If

x_1^2  + x_2^2

is less than or equal to 1, then x_1/x_2 is delivered as the Cauchy deviate; otherwise, x_1 and x_2 are rejected and two new uniform (-1, 1) deviates are generated. This method is also equivalent to taking the ratio of two independent normal deviates.

Deviates from the Cauchy distribution with median t and first quartile t - s, that is, with density

f\left( x \right) = \frac{s}{{\pi \left[ 
            {s^2  + \left( {x - t} \right)^2 } \right]}}

can be obtained by scaling the output from NextCauchy. To do this, first scale the output from NextCauchy by S and then add T to the result.

See Also