unidinv
              Inverse of the discrete uniform cumulative distribution function (iCDF).
 For each element of p, compute the quantile (the inverse of the CDF) of
 the discrete uniform distribution with parameter N, which corresponds
 to the maximum observable value.  unidinv assumes the integer values
 in the range  with equal probability.  The size of x is the
 common size of p and N.  A scalar input functions as a constant
 matrix of the same size as the other inputs.
 The maximum observable values in N must be positive integers, otherwise
 NaN is returned.
 Warning: The underlying implementation uses the double class and will only
 be accurate for N < flintmax ( on
 IEEE 754 compatible systems).
Further information about the discrete uniform distribution can be found at https://en.wikipedia.org/wiki/Discrete_uniform_distribution
See also: unidcdf, unidpdf, unidrnd, unidfit, unidstat
Source Code: unidinv
| 
 ## Plot various iCDFs from the discrete uniform distribution
 p = 0.001:0.001:0.999;
 x1 = unidinv (p, 5);
 x2 = unidinv (p, 9);
 plot (p, x1, "-b", p, x2, "-g")
 grid on
 xlim ([0, 1])
 ylim ([0, 10])
 legend ({"N = 5", "N = 9"}, "location", "northwest")
 title ("Discrete uniform iCDF")
 xlabel ("probability")
 ylabel ("values in x")
                     | 
