Engee documentation

Random Integer Generator

Generates integers randomly distributed in the specified range.

random integer generator

Description

The Random Integer Generator block generates uniformly distributed random integers in the range [0, M-1] where M is specified by the Set size parameter. Use this block to generate random binary or integer data.

Ports

Output

Out - random integer output
scalar | vector | matrix

Random integer output returned as a scalar, vector, or matrix. This port has no name in the block. The data type is specified using the Output data type parameter.

The number of rows in the output data is equal to the value of the Samples per frame parameter and corresponds to the number of samples in one frame. The number of columns in the output data is equal to the number of elements in the Set size parameter and corresponds to the number of channels.

Data types: Int,Bool.

Parameters

Set size - set size
8 (by default) | positive integer | vector-string of positive integers

Set size, M, specified as a positive integer or vector-string of positive integers. The block generates integers in the range [0, (M-1)]. The number of elements in Set size corresponds to the number of independent channels output from the block.

  • If Set size is a scalar, all output random variables are independent and equally distributed.

  • If Set size is a vector, the length of the vector determines the number of output channels. Channels can have different output ranges.

Source of initial seed - source of initial value
Parameter (by default).

The source of the initial value for the random number generator in the form:

  • Parameter - block sets the initial number of the random number generator to Initial seed.

Initial seed - initial number
0 (by default) | non-negative integer.

Initial value for the random number generator as a non-negative integer. If Initial seed is a constant, the resulting sequence is repeatable.

Dependencies

To use this parameter, set the Source of initial seed parameter to Parameter.

Sample time - sampling period
1 (by default) | -1 | positive scalar

The sampling period specified as a positive number. To inherit the sampling period, set this parameter to -1.

Samples per frame - samples per output frame
1 (by default) | -1 | positive number

Samples per frame as a positive integer indicating the number of samples per frame in one output data channel.

Output data type - output data type
Int (by default) | Bool

Output data type as Int, or Bool.

If this parameter is set to Bool, you must set the Set size parameter to 2.

Read more

Time selection

The time between output updates is equal to the product of Samples per frame and Sample time. For example, if Sample time and Samples per frame are equal to 1, the block outputs a sample every second. If you increase Samples per frame to 10, the block outputs a 10 by 1 vector every 10 seconds. This ensures that the equivalent output rate is independent of the Samples per frame parameter.