nag_rand_int_uniform (g05tl) generates the next
values
from a uniform
generator (see
nag_rand_dist_uniform01 (g05sa) for details) and applies the transformation
where
is the integer part of the real value
. The function ensures that the values
lie in the closed interval
.
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_int_uniform (g05tl).
None.
Not applicable.
None.
This example prints five pseudorandom integers from a discrete uniform distribution between
and
, generated by a single call to
nag_rand_int_uniform (g05tl), after initialization by
nag_rand_init_repeat (g05kf).
function g05tl_example
fprintf('g05tl example results\n\n');
seed = [int64(1762543)];
genid = int64(1);
subid = int64(1);
[state, ifail] = g05kf( ...
genid, subid, seed);
n = int64(5);
a = int64(-5);
b = int64(5);
[state, x, ifail] = g05tl( ...
n, a, b, state);
disp('Variates');
disp(double(x));