nag_random_discrete_uniform (g05dyc) returns a pseudorandom integer taken from a uniform distribution over the interval .
The distribution of a uniform random variable,
, is given by
. The function returns the value
where [ ] denotes the integer part, and
is a pseudorandom number from a uniform distribution over (0,1), generated by nag_random_continuous_uniform (g05cac)
, the roles of
The example program prints the first five pseudorandom integers from a uniform distribution between -5 and 5, generated by nag_random_discrete_uniform (g05dyc) after initialization by nag_random_init_repeatable (g05cbc)