Function Reference: unidrnd

statistics: r = unidrnd (N)
statistics: r = unidrnd (N, rows)
statistics: r = unidrnd (N, rows, cols, …)
statistics: r = unidrnd (N, [sz])

Random arrays from the discrete uniform distribution.

r = unidrnd (N) returns an array of random numbers chosen from the discrete uniform distribution with parameter N, which corresponds to the maximum observable value. unidrnd assumes the integer values in the range [1,N] with equal probability. The size of r is the size of 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.

When called with a single size argument, unidrnd returns a square matrix with the dimension specified. When called with more than one scalar argument, the first two arguments are taken as the number of rows and columns and any further arguments specify additional matrix dimensions. The size may also be specified with a row vector of dimensions, sz.

Warning: The underlying implementation uses the double class and will only be accurate for N < flintmax (2^53 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, unidinv, unidrnd, unidfit, unidstat

Source Code: unidrnd