functionrandom
Returns a uniform random number with the xorshift64* algorithm
Extends from Interfaces.random (Return a random number with a uniform distribution in the range 0.0 < result <= 1.0).
Information
Syntax
(r, stateOut) = Xorshift64star.random(stateIn);
Description
Returns a uniform random number r in the range 0 < r ≤ 1 with the xorshift64* algorithm. Input argument stateIn is the state vector of the previous call. Output argument stateOut is the updated state vector. If the function is called with identical stateIn vectors, exactly the same random number r is returned.
Example
parameter Integer localSeed;
parameter Integer globalSeed;
Real r;
Integer state[Xorshift64star.nState];
initial equation
state = initialState(localSeed, globalSeed);
equation
when sample(0,0.1) then
(r, state) = random(pre(state));
end when;
See also
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | stateIn (from random) | The internal states for the random number generator | |
| Integer | stateSize (from random) | The dimension of the internal state vector |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Real | result (from random) | A random number with a uniform distribution on the interval (0,1] | |
| Integer | stateOut (from random) | The new internal states of the random number generator |
Revisions
| Date | Description | ||
|---|---|---|---|
| June 22, 2015 |
|