WOLFRAM SYSTEM MODELER

automaticGlobalSeed

Creates an automatic integer seed (typically from the current time and process id; this is an impure function)

Wolfram Language

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

Information

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

Syntax

seed = Utilities.automaticGlobalSeed();

Description

Returns an automatically computed seed (Integer). Typically, this seed is computed from:

  1. The current local time by computing the number of milli-seconds up to the current hour
  2. The process id (added to the first part by multiplying it with the prime number 6007).

If getTime and getPid functions are not available on the target where this Modelica function is called, other means to compute a seed may be used.

Note, this is an impure function that returns always a different value, when it is newly called. This function should be only called once during initialization.

Example

parameter Boolean useAutomaticSeed = false;
parameter Integer fixedSeed = 67867967;
final parameter Integer seed = if useAutomaticSeed then
                              Random.Utilities.automaticGlobalSeed() else fixedSeed;

See also

automaticLocalSeed.

Note

This function is impure!

Syntax

seed = automaticGlobalSeed()

Outputs (1)

seed

Type: Integer

Description: Automatically generated seed

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