Statistics Toolbox | ![]() ![]() |
Random numbers from the discrete uniform distribution.
Syntax
R = unidrnd(N) R = unidrnd(N,mm) R = unidrnd(N,mm,nn)
Description
The discrete uniform distribution arises from experiments equivalent to drawing a number from one to N out of a hat.
R = unidrnd(N)
generates discrete uniform random numbers with maximum N
. The parameters in N must be positive integers. The size of R is the size of N.
R = unidrnd(N,mm)
generates discrete uniform random numbers with maximum N, where mm is a 1-by-2 vector that contains the row and column dimensions of R.
R = unidrnd(N,mm,nn)
generates discrete uniform random numbers with maximum N, where scalars mm and nn are the row and column dimensions of R.
Examples
In the Massachusetts lottery, a player chooses a four digit number. Generate random numbers for Monday through Saturday.
numbers = unidrnd(10000,1,6) - 1 numbers = 2189 470 6788 6792 9346
See Also
unidcdf
, unidinv
, unidpdf
, unidstat
![]() | unidpdf | unidstat | ![]() |