randomReturns a uniform random number with the xorshift1024* algorithm |
This information is part of the Modelica Standard Library maintained by the Modelica Association.
(r, stateOut) = Xorshift128plus.random(stateIn);
Returns a uniform random number in the range 0 < random ≤ 1 with the xorshift1024* 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.
parameter Integer localSeed; parameter Integer globalSeed; Real r; Integer state[Xorshift1024star.nState]; initial equation state = initialState(localSeed, globalSeed); equation when sample(0,0.1) then (r, state) = random(pre(state)); end when;
stateIn |
Type: Integer[nState] Description: The internal states for the random number generator |
---|
result |
Type: Real Description: A random number with a uniform distribution on the interval (0,1] |
---|---|
stateOut |
Type: Integer[nState] Description: The new internal states of the random number generator |