[RANDOM] Random number generation

Function block RANDOM supplies a random output signal.

RANDOM supplies a random output signal. Issuance of the new values can be determined: Either by random or constant time intervals. The value range of the output signal can be limited.

Functioning

Function block RANDOM generates a real value output signal [Out] and a binary output signal [Imp].

The real values of [Out] are distributed at random across the value range [OutMin], [OutMax].

The output values of [Out] and [Imp] are issued at random intervals between [TiMin], [TiMax] or at constant intervals (e.g. every 10 seconds).

Random value [Out] at intervals between [TiMin] and [TiMax].

If [TiMin] < [TiMax], then a new random value at output [Out] is issued at the earliest after [TiMin] and at the latest after [TiMax]. A new pulse [Imp] is issued at the same time.

Each pulse lasts one program cycle.

Random value [Out] in each program cycle.

If [TiMin] = [TiMax] = 0, then a new random value at output [Out] is issued in each program cycle. The binary output signal [Imp] is constant: [Imp] = 1.

Random value at output [Out] at constant intervals

  • Prerequisite: x <> 0

If [TiMin] = [TiMax] = x, then a new random value [Out] is always issued after time x. A new pulse [Imp] is issued at the same time.

Each pulse lasts one program cycle.

Pins

Input

Description

Data type

Default value
Value range

EnFnct

Enable function

Enables the function.

Boolean

1

0 - The function is disabled.
1 - The function is enabled.

OutMax

Maximum output value

Maximum default value for [Out].

Real

100.0

OutMin

Minimum output value

Minimum default value for [Out].

Real

0.0

TiMax

Maximum time

A new value [Out] is generated at the latest after this max. time.

Time

0 ms

0 - The sampling time lasts one program cycle.
[TiMin]=[TiMax] - Constant pulse sequence.

TiMin

Minimum time

A new value [Out] is generated at the earliest after this min. time.

Time

0 ms

0 - The shortest sampling time lasts one program cycle.
[TiMin]=[TiMax] - Constant pulse sequence.

 

Output

Description

Data type

Default value
Value range

Out

Output

Real

0.0

Imp

Impulse

[TiMin]<>[TiMax] - Each pulse lasts one program cycle.
[TiMin]=[TiMax]= 0 - [Imp] = Constant = 1.

Boolean

0

0 - Off
1 - On

Application

RANDOM allows for the following applications:

  • Generate time-random pulses e.g. for random switch-on or switch-off of any functions or components.
  • Generate a random value for further use.