RANDI Uniformly Distributed Integer

Section: Random Number Generation


Generates an array of uniformly distributed integers between the two supplied limits. The general syntax for randi is
   y = randi(low,high)

where low and high are arrays of integers. Scalars can be used for one of the arguments. The output y is a uniformly distributed pseudo-random number between low and high (inclusive).


Here is an example of a set of random integers between zero and 5:
--> randi(zeros(1,6),5*ones(1,6))

ans = 
 1 0 4 1 5 0