next up previous contents
Next: RANDCHI Generate Chi-Square Random Up: Random Number Generation Previous: RANDBETA Beta Deviate Random   Contents

Subsections

RANDI Uniformly Distributed Integer

Usage

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).

Example

Here is an example of a set of random integers between zero and 5:

--> randi(zeros(1,6),5*ones(1,6))
ans = 
  <int32>  - size: [1 6]
 
Columns 1 to 5
             1              1              1              4              1  
 
Columns 6 to 6
             4



Samit K. Basu 2005-03-16