.Modelica.Math.Random.Utilities.automaticGlobalSeed

Information

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;

Note

This function is impure!

Interface

function automaticGlobalSeed
  extends Modelica.Icons.Function;
  output Integer seed "Automatically generated seed";
end automaticGlobalSeed;

Revisions

Date Description
June 22, 2015
Initial version implemented by A. Klöckner, F. v.d. Linden, D. Zimmer, M. Otter.
DLR Institute of System Dynamics and Control

Generated at 2020-06-05T07:38:22Z by OpenModelica 1.16.0~dev-420-gc007a39