modelGenerateRandomNumbers

Generate random numbers with the various random number generators

Extends from Modelica.Icons.Example (Icon for runnable examples).

Information

This example demonstrates how to utilize the random number generators of package Math.Random.Generators in a Modelica model. The example calculates random numbers in the range 0 .. 1 of the available random number generators periodically with a sample period of 0.05 s. Simulations results are shown in the figure below:

Parameters

TypeNameDefaultDescription
Modelica.Units.SI.PeriodsamplePeriod0.05Sample period for the generation of random numbers
IntegerglobalSeed30020Global seed to initialize random number generator
IntegerlocalSeed614657Local seed to initialize random number generator
IntegeridUtilities.initializeImpureRandom(globalSeed)A unique number used to sort equations correctly

Components

TypeNameDefaultDescription
Realr64Random number generated with Xorshift64star
Realr128Random number generated with Xorshift128plus
Realr1024Random number generated with Xorshift1024star
RealrImpureImpure Real random number
IntegeriImpureImpure Integer random number

Revisions

Date Description
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