Accelerating the pace of engineering and science

# Bernoulli Binary Generator

Generate Bernoulli-distributed random binary numbers

## Library

Random Data Sources sublibrary of Comm Sources

## Description

The Bernoulli Binary Generator block generates random binary numbers using a Bernoulli distribution. The Bernoulli distribution with parameter p produces zero with probability p and one with probability 1-p. The Bernoulli distribution has mean value 1-p and variance p(1-p). The Probability of a zero parameter specifies p, and can be any real number between zero and one.

### 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 and Probability of a zero parameters 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 and Probability of a zero parameters becomes the shape of a sample-based two-dimensional output signal.

## Dialog Box

Probability of a zero

The probability with which a zero output occurs.

Initial seed

The initial seed value for the random number generator. The seed can be either a vector of the same length as the Probability of a zero parameter, or a scalar.

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.