IMSL C# Numerical Library

Random.NextLogarithmic Method 

Generate a pseudorandom number from a logarithmic distribution.

public virtual int NextLogarithmic(
   double a
);

Parameters

a
A double which specifies the parameter of the logarithmic distribution, 0 \lt a \lt 1.

Return Value

A int which specifies a pseudorandom number from a logarithmic distribution.

Remarks

Method NextLogarithmic generates pseudorandom numbers from a logarithmic distribution with parameter a. The probability function is

f\left( x \right) =  - \frac{{a^x }}{{x\ln 
            \left( {1 - a} \right)}}

for x = 1, 2, 3, \ldots, and 0 \lt a \lt 1.

The methods used are described by Kemp (1981) and depend on the value of a. If a is less than 0.95, Kemp's algorithm LS, which is a "chop-down" variant of an inverse CDF technique, is used. Otherwise, Kemp's algorithm LK, which gives special treatment to the highly probable values of 1 and 2, is used.

See Also

Random Class | Imsl.Stat Namespace | Example