RANDOM

ScriptEigener Objekttyp in der Automation Engine Function: Generates random numbers.

Syntax

RANDOM(Minimum, Maximum, [Basis])

Syntax

Description/Format

Minimum

Minimal value of the generated random number.
Format: Number or script variable

Maximum

Maximal value of the generated random number.
Format: Number or script variable

Basis

Initial value for generation.
Format: Number or script variable


Return code

Random number within the specified range.

Comment

The script function RANDOM generates random numbers. A number generator creates a number set that is determined by using its initial value - the Basis.

If you do not specify Basis, this script function returns a number that continuously varies between Minimum and Maximum.

If Basis is specified, the random number generator is initialized by this value. The result is a numerical series whose numbers can be read without the Basis being necessary. For a particular initial value, the generated numerical series is always identical: the same numbers are supplied in the same order.

If this script function is processed in a different object at the same time, the numerical series that has already been generated is overwritten.

You can only assign positive integers (data type "unsigned") to this script function. The result is also always a positive integer.

Examples

Please note that the generated numerical series when using Basis "1" is an example. Depending on the platform RANDOM is being executed on the series may be different.

See also:

Script element Description

ADD

Performs an addition.
SUB Performs a subtraction.
MULT Performs a multiplication.
MOD Returns the remainder of a division.
DIV Returns the remainder of a division.

Script Elements - Arithmetics

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by Function