Engee documentation

Random Source

Generator of randomly distributed values.

blockType: RandomSource

Path in the library:

/Basic/Sources/Random Source

Description

The Random Source block outputs a random signal with a uniform or Gaussian (normal) pseudo-random distribution. The block uses the Mersenne vortex random number generator to generate the sequence. The parameters of the block determine the size of the signal, the type of data, and whether the signal is complex.

The block can generate a single-channel or multi-channel signal.

Ports

Output

# OUT_1 — randomly distributed signal
scalar | vector | matrix

Details

A random variable signal with a uniform or Gaussian (normal) distribution. The parameters of the block determine the size of the signal, the type of data and whether the signal is complex.

The block can generate a single-channel or multi-channel signal. The parameters Samples per frame determine the number of samples in each channel (column) of the signal. The parameters Output data type and Complexity determine the data type and whether the signal is complex.

Data types

Float64.

Complex numbers support

Yes

Parameters

Main

# Source type — distribution type
Uniform | Gaussian

Details

Specify the type of distribution of random variables, options to choose from:

  • Uniform - the block takes output samples from a uniform distribution. You can specify the minimum and maximum values of the distribution using the parameters Minimum and Maximum respectively. All values in the range [Minimum Maximum ] have equal probability of being selected. You can generate a complex number from a uniform distribution by setting the Complexity parameters to Complex.

  • Gaussian - block generates Gaussian random variables using the Ziggurat method. You can set the mean and variance of the distribution using the parameters Mean and Variance. You can generate a complex Gaussian signal by setting the parameters Complexity to Complex.

Values

Uniform | Gaussian

Default value

Uniform

Program usage name

SourceType

Tunable

No

Evaluatable

No

# Method — random number generation method
Ziggurat | Sum of uniform values

Details

Random number generation method.

Dependencies

To use this parameter, set the Source type parameters to Gaussian.

Values

Ziggurat | Sum of uniform values

Default value

Ziggurat

Program usage name

Method

Tunable

No

Evaluatable

No

# Number of uniform values to sum — number of constant values to summarise
Int64 integer

Details

Number of constant values for summing.

Dependencies

To use this parameter, set the Source type parameter to and the parameter to . Gaussian`and set the Method parameters to . `Sum of uniform values.

Default value

12

Program usage name

NumberOfUniformValuesToSum

Tunable

No

Evaluatable

Yes

# Mean — mean value of the Gaussian distribution

Details

Specify the mean value of a Gaussian (normal) distribution as a scalar or a string vector of length . If a string vector is specified, the block generates a matrix to , containing a separate random distribution in each channel, where is the value that is specified in the parameters Samples per frame.

The values of parameters Mean and Variance must be scalars or have the same number of columns.

To generate a complex output signal with distribution Gaussian`set the value for the parameter Complexity to `Complex and specify the complex value in the parameter Mean. For more information, see the description of the parameter Complexity.

Dependencies

To use this parameter, set the Source type parameters to . Gaussian.

Support for complex numbers

Yes

Default value

0

Program usage name

Mean

Tunable

Yes

Evaluatable

Yes

# Variance — variance of the Gaussian distribution

Details

Specify the variance of a Gaussian (normal) distribution as a scalar or string vector of length . If a string vector is specified, the block generates a matrix to , containing a separate random distribution in each channel, where is the value that is specified in the parameters Samples per frame.

The values of parameters Mean and Variance must be scalars or have the same number of columns.

To generate a complex output signal with distribution Gaussian, set the parameters Variance to the total variance for each output channel. This value is the sum of the variance of the real and imaginary components in that channel. For more information, see the description of the parameters Complexity.

Dependencies

To use this parameter, set the Source type parameters to Gaussian.

Default value

1

Program usage name

Variance

Tunable

Yes

Evaluatable

Yes

# Minimum — minimum value of uniform distribution

Details

Specify the minimum value in the uniform distribution as a scalar or string vector of length . If a string vector is specified, the block generates a matrix to , containing a separate random distribution in each channel, where is the value that is specified in the parameters Samples per frame.

For example, if the value of Minimum is [0, 0, -3, -3] and Maximum is [10, 10, 20, 20], then the block generates a four-channel output whose first and second columns contain random values in the range [0, 10] and whose third and fourth columns contain random values in the range [-3, 20].

The values Minimum and Maximum must be scalars or have the same number of columns.

Dependencies

To use this parameter, set the parameter Source type to Uniform.

Default value

0

Program usage name

Minimum

Tunable

Yes

Evaluatable

Yes

# Maximum — maximum value of uniform distribution

Details

Specify the maximum value in the uniform distribution as a scalar or string vector of length . If a string vector is specified, the block generates a matrix to , containing a separate random distribution in each channel, where is the value that is specified in the parameters Samples per frame.

For example, if the value of Minimum is [0, 0, -3, -3] and Maximum is [10, 10, 20, 20], then the block generates a four-channel output whose first and second columns contain random values in the range [0, 10] and whose third and fourth columns contain random values in the range [-3, 20].

The values Minimum and Maximum must be scalars or have the same number of columns.

Dependencies

To use this parameter, set the parameter Source type to Uniform.

Default value

1

Program usage name

Maximum

Tunable

Yes

Evaluatable

Yes

# Repeatability — block output repetition
Specify seed | Repeatable | Not repeatable

Details

Option to repeat the block output. Options to select:

  • Specify seed - the block uses the initial number that is specified in the parameters Initial seed, to produce repeated output for each simulation.

  • Not repeatable - the block randomly selects an initial number and produces a different pseudo-random sequence for each simulation.

  • Repeatable

Values

Specify seed | Repeatable | Not repeatable

Default value

Not repeatable

Program usage name

Repeatability

Tunable

No

Evaluatable

No

# Initial seed — initial number for the random number generator

Details

Specify an initial number for a random number generator in the form of a scalar. The generator produces an identical sequence of pseudo-random numbers each time a block with a certain initial number is simulated.

Dependencies

To use this parameter, set the Repeatability parameter to . Specify seed.

Default value

1

Program usage name

InitialSeed

Tunable

Yes

Evaluatable

Yes

# Sample mode — signal type
Discrete | Continuous

Details

Signal Type. Options for selection:

  • Discrete - discrete signal.

  • Continuous - continuous signal.

Values

Discrete | Continuous

Default value

Discrete

Program usage name

SampleMode

Tunable

No

Evaluatable

No

# Sample time — output data sampling period
SampleTime (real number / vector of two real numbers)

Details

The output sampling period, of a random output sequence, is specified as a positive scalar. The period of the output frame is equal to .

Dependencies

To use this parameter, set the parameter Sample mode to Discrete.

Default value

1

Program usage name

SampleTime

Tunable

No

Evaluatable

Yes

# Samples per frame — counts per frame
Int64 integer

Details

The number of samples in each output frame, specified as a positive integer scalar. The period of the output frame is equal to , where is the value of the parameters Sample time.

Dependencies

To use this parameter, set the Sample mode parameter to . Discrete.

Default value

1

Program usage name

SamplesPerFrame

Tunable

No

Evaluatable

Yes

# Output data type — output data type
Double

Details

Output data type.

Values

Double

Default value

Double

Program usage name

OutputDataType

Tunable

No

Evaluatable

No

# Complexity — real or complex signal
Real | Complex

Details

Specify whether the output signal is real Real or complex Complex. These parameters control all output channels. The real and complex components of the output are statistically independent.

For complex output with distribution Uniform block takes the real and imaginary components in each channel from the same uniform random distribution defined by the parameters Minimum and Maximum for that channel.

For complex output with distribution Gaussian the block takes the real and imaginary components in each channel from normal distributions with different averages. In this case, the parameter Mean for each channel must have a complex value. The real component of the parameter Mean determines the mean of the real components in the channel, and the imaginary component determines the mean of the imaginary components in the channel. If the real or imaginary component in the Mean parameters is omitted, the block uses the default value 0 for the average value of this component.

For example, if the parameters Mean has [5+2i 0.5 3i] in it, a three-channel output with these average values is generated.

Channel number Real component Minor component

1

5

2

2

0.5

0

3

0

3

For a complex output signal, the parameters Variance determines the total variance for each output channel. This value is the sum of the variance of the real and imaginary components in that channel:

.

The block divides the specified variance value equally between the real and imaginary components.

,

.

Values

Real | Complex

Default value

Real

Program usage name

Complexity

Tunable

No

Evaluatable

No

Read More

Uniform distribution

A uniform distribution is a type of probability distribution in which all outcomes are equally likely.

Scalar random variable.

Consider a scalar random variable , which the block takes from the uniform distribution U:

,

where and are the minimum and maximum values of the distribution, respectively.

Alternatively, we can write in terms of a scaled normalised uniform variable:

,

.

A uniform random vector.

If a block is configured to have channels, then each output sample is a random vector of independent data. We can write as , where , with и - are the minimum and maximum values of the vector parameters, respectively. If the parameter Samples per frame is set to , then each output frame is a by matrix of independent homogeneous uniform random vector rows.

Complex uniform random variable.

If the block is configured to generate a complex scalar random variable , where .

Alternatively, we can write as

,

.

Complex uniform random vector.

Where is a vector of complex random variables , where are independent.

Gaussian distribution

Scalar random variable

If the block is configured to generate a random variable from a Gaussian (or normal) distribution, the variable , where and are the mean and variance, respectively.

Alternatively, you can write as , where is the standard normal variable.

Gaussian random vector.

If there are channels in a block, then each output sample is a random vector of independent data. We can write the Gaussian random vector as , where , where и - are the mean and variance of channels, respectively. The covariance matrix of the vector is a diagonal matrix represented as

.

Complex Gaussian random variable.

If the block is configured to generate a complex scalar random variable , where and are independent. The mean value must be complex.

Alternatively, you can write as

.

Complex Gaussian random vector.

Where is a vector of complex random variables , where and , и - are the mean and variance of channels, respectively.