WOLFRAM SYSTEM MODELER

impureRandomInteger

Impure random number generator for integer values (with hidden state vector)

Wolfram Language

In[1]:=
SystemModel["Modelica.Math.Random.Utilities.impureRandomInteger"]
Out[1]:=

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

Syntax

r = impureRandomInteger(id, imin=1, imax=Modelica.Constants.Integer_inf);

Description

Returns an Integer random number in the range imin ≤ random ≤ imax with the xorshift1024* algorithm, (the random number in the range 0 ... 1 returned by the xorshift1024* algorithm is mapped to an Integer number in the range imin ... imax). The dummy input Integer argument id must be the output argument of a call to function initializeImpureRandom, in order that the sorting order is correct (so that impureRandomInteger is always called after initializeImpureRandom). For every call of impureRandomInteger(id), a different random number is returned, so the function is impure.

See also

initializeImpureRandom, Random.Generators

Note

This function is impure!

Syntax

y = impureRandomInteger(id, imin, imax)

Inputs (3)

id

Type: Integer

Description: Identification number from initializeImpureRandom(..) function (is needed for correct sorting)

imin

Default Value: 1

Type: Integer

Description: Minimum integer to generate

imax

Default Value: 268435456

Type: Integer

Description: Maximum integer to generate (default = 2^28)

Outputs (1)

y

Type: Integer

Description: A random number with a uniform distribution on the interval [imin,imax]

Revisions

Date Description
June 2, 2017Correct probabilities - especially for small ranges, by Hans Olsson, Dassault Systèmes
June 22, 2015
DLR logo Initial version implemented by A. Klöckner, F. v.d. Linden, D. Zimmer, M. Otter.
DLR Institute of System Dynamics and Control