FreeMat

- Main Page
- Related Pages

RANDI Uniformly Distributed Integer

Section: Random Number Generation

# 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 =
     5 5 0 4 4 2