# mxnet.np.random.lognormal¶

lognormal(mean=0.0, sigma=1.0, size=None, dtype=None, device=None, out=None)

Draw samples from a log-normal distribution.

Draw samples from a log-normal distribution 1 with specified mean, standard deviation, and array shape. Note that the mean and standard deviation are not the values for the distribution itself, but of the underlying normal distribution it is derived from.

Parameters
• mean (float or array_like of floats, optional) – Mean value of the underlying normal distribution. Default is 0.

• sigma (float or array_like of floats, optional) – Standard deviation of the underlying normal distribution. Must be non-negative. Default is 1.

• size (int or tuple of ints, optional) – Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. If size is None (default), a single value is returned if mean and sigma are both scalars. Otherwise, np.broadcast(mean, sigma).size samples are drawn.

• dtype ({'float16', 'float32', 'float64'}, optional) – Data type of output samples. Default is ‘float32’

• device (Device, optional) – Device context of output. Default is current device.

• out (ndarray, optional) – Store output to an existing ndarray.

Returns

out – Drawn samples from the parameterized log-normal distribution.

Return type

ndarray or scalar

Notes

A variable x has a log-normal distribution if log(x) is normally distributed. The probability density function for the log-normal distribution 2 is:

$p(x) = \frac{1}{\sigma x \sqrt{2\pi}} e^{(-\frac{(ln(x)-\mu)^2}{2\sigma^2})}$

where $$\mu$$ is the mean and $$\sigma$$ is the standard deviation of the normally distributed logarithm of the variable. A log-normal distribution results if a random variable is the product of a large number of independent, identically-distributed variables in the same way that a normal distribution results if the variable is the sum of a large number of independent, identically-distributed variables.

References

1

Limpert, E., Stahel, W. A., and Abbt, M., “Log-normal Distributions across the Sciences: Keys and Clues,” BioScience, Vol. 51, No. 5, May, 2001. http://www.statlit.org/pdf/2001-Limpert-Bioscience2.pdf

2

Reiss, R.D. and Thomas, M., “Statistical Analysis of Extreme Values,” Basel: Birkhauser Verlag, 2001, pp. 31-32.

Examples

Draw samples from the distribution: >>> mu, sigma = 3., 1. # mean and standard deviation >>> s = np.random.lognormal(mu, sigma, 1000)