impure functionautomaticGlobalSeed
Creates an automatic integer seed (typically from the current time and process id; this is an impure function)
Extends from Modelica.Icons.Function (Icon for functions).
Information
Syntax
seed = Utilities.automaticGlobalSeed();
Description
Returns an automatically computed seed (Integer). Typically, this seed is computed from:
- The current local time by computing the number of milli-seconds up to the current hour
- 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
Note
This function is impure!
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | seed | Automatically generated seed |
Revisions
| Date | Description | ||
|---|---|---|---|
| June 22, 2015 |
|