This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Uniform Random Number

Generate uniformly distributed random numbers

  • Library:
  • Simulink / Sources

Description

The Uniform Random Number block generates uniformly distributed random numbers over an interval that you specify. To generate normally distributed random numbers, use the Random Number block.

You can generate a repeatable sequence using any Uniform Random Number block with the same nonnegative seed and parameters. The seed resets to the specified value each time a simulation starts.

Avoid integrating a random signal, because solvers must integrate relatively smooth signals. Instead, use the Band-Limited White Noise block.

The numeric parameters of this block must have the same dimensions after scalar expansion. If you select the Interpret vector parameters as 1-D check box and the numeric parameters are row or column vectors after scalar expansion, the block outputs a 1-D signal. If you clear the Interpret vector parameters as 1-D check box, the block outputs a signal of the same dimensionality as the parameters.

Ports

Output

expand all

Output signal of generated uniformly distributed random numbers over the interval you specify.

Data Types: double

Parameters

expand all

Specify the minimum of the interval.

Programmatic Use

Block Parameter: Minimum
Type: character vector
Values: scalar
Default: '-1'

Specify the maximum of the interval.

Programmatic Use

Block Parameter: Maximum
Type: character vector
Values: scalar
Default: '1'

Specify the starting seed for the random number generator.

The seed must be 0 or a positive integer. Output is repeatable for a given seed.

Programmatic Use

Block Parameter: See
Type: character vector
Values: scalar
Default: '0'

Specify the time interval between samples. See Specify Sample Time in the Simulink® documentation for more information.

Programmatic Use

Block Parameter: SampleTime
Type: character vector
Values: scalar
Default: '0.1'

Select this check box to output a vector of length N if the Constant value parameter evaluates to an N-element row or column vector.

  • When you select this check box, the block outputs a vector of length N if the Constant value parameter evaluates to an N-element row or column vector. For example, the block outputs a matrix of dimension 1-by-N or N-by-1.

  • When you clear this check box, the block does not output a vector of length N if the Constant value parameter evaluates to an N-element row or column vector.

Programmatic Use

Block Parameter: VectorParams1D
Type: character vector
Values: 'on' | 'off'
Default: 'on'

Block Characteristics

Data Types

double

Direct Feedthrough

no

Multidimensional Signals

yes

Variable-Size Signals

no

Zero-Crossing Detection

no

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Introduced before R2006a