.Modelica_Noise.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 localtime 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!

Interface

function automaticGlobalSeed
  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 2024-12-28T19:26:00Z by OpenModelicaOpenModelica 1.24.3 using GenerateDoc.mos