The distribution has PDF (probability density function)
i.e.,
is normally distributed with mean
and variance
.
nag_rand_dist_lognormal (g05sm) evaluates
, where the
are generated by
nag_rand_dist_normal (g05sk) from a Normal distribution with mean
and variance
, for
.
One of the initialization functions
nag_rand_init_repeat (g05kf) (for a repeatable sequence if computed sequentially) or
nag_rand_init_nonrepeat (g05kg) (for a non-repeatable sequence) must be called prior to the first call to
nag_rand_dist_lognormal (g05sm).
None.
Not applicable.
None.
This example prints five pseudorandom numbers from a log-normal distribution with mean
and variance
, generated by a single call to
nag_rand_dist_lognormal (g05sm), after initialization by
nag_rand_init_repeat (g05kf).
function g05sm_example
fprintf('g05sm example results\n\n');
seed = [int64(1762543)];
genid = int64(1);
subid = int64(1);
[state, ifail] = g05kf( ...
genid, subid, seed);
n = int64(5);
xmu = 1;
var = 2;
[state, x, ifail] = g05sm( ...
n, xmu, var, state);
disp('Variates');
disp(x);