IMSL C# Numerical Library

Random.NextLogNormal Method 

Generate a pseudorandom number from a lognormal distribution.

public virtual double NextLogNormal(
   double mean,
   double stdev
);

Parameters

mean
A double which specifies the mean of the underlying normal distribution.
stdev
A double which specifies the standard deviation of the underlying normal distribution. It must be positive.

Return Value

A double which specifies a pseudorandom number from a lognormal distribution.

Remarks

Method NextLogNormal generates pseudorandom numbers from a lognormal distribution with parameters mean and stdev. The scale parameter in the underlying normal distribution, stdev, must be positive. The method is to generate normal deviates with mean mean and standard deviation stdev and then to exponentiate the normal deviates.

With \mu = mean and \sigma = stdev, the probability density function for the lognormal distribution is

f\left( x \right) = \frac{1}{{\sigma 
            x\sqrt {2\pi } }}\exp \left[ { - \frac{1}{{2\sigma ^2 }}\left( {\ln 
            x - \mu } \right)^2 } \right]\,\,for\,x > 0

The mean and variance of the lognormal distribution are \rm exp(\mu + \sigma2/2) and \rm exp(2\mu+ 2\sigma2) - \rm exp(2\mu+ \sigma2), respectively.

See Also

Random Class | Imsl.Stat Namespace | Example