Accelerating the pace of engineering and science

• Trials

# Random Integer Generator

Generate integers randomly distributed in range [0, M-1]

## Library

Random Data Sources sublibrary of Comm Sources

## Description

The Random Integer Generator block generates uniformly distributed random integers in the range [0, M-1], where M is the M-ary number defined in the dialog box.

The M-ary number can be either a scalar or a vector. If it is a scalar, then all output random variables are independent and identically distributed (i.i.d.). If the M-ary number is a vector, then its length must equal the length of the Initial seed; in this case each output has its own output range.

If the Initial seed parameter is a constant, then the resulting noise is repeatable.

### Attributes of Output Signal

The output signal can be a frame-based matrix, a sample-based row or column vector, or a sample-based one-dimensional array. These attributes are controlled by the Frame-based outputs, Samples per frame, and Interpret vector parameters as 1-D parameters. See Sources and Sinks in Communications System Toolbox™User's Guide for more details.

The number of elements in the Initial seed parameter becomes the number of columns in a frame-based output or the number of elements in a sample-based vector output. Also, the shape (row or column) of the Initial seed parameter becomes the shape of a sample-based two-dimensional output signal.

## Dialog Box

M-ary number

The positive integer, or vector of positive integers, that indicates the range of output values.

Initial seed

The initial seed value for the random number generator. The vector length of the seed determines the length of the output vector.

Sample time

The period of each sample-based vector or each row of a frame-based matrix.

Frame-based outputs

Determines whether the output is frame-based or sample-based. This box is active only if Interpret vector parameters as 1-D is unchecked.

Samples per frame

The number of samples in each column of a frame-based output signal. This field is active only if Frame-based outputs is checked.

Interpret vector parameters as 1-D

If this box is checked, then the output is a one-dimensional signal. Otherwise, the output is a two-dimensional signal. This box is active only if Frame-based outputs is unchecked.

Output data type

The output type of the block can be specified as a boolean, int8, uint8, int16, uint16, int32, uint32, single, or double. By default, the block sets this to double. Single outputs may lead to different results when compared with double outputs for the same set of parameters. For Boolean typed outputs, the M-ary number must be 2.