id = initializeImpureRandom(seed;
Generates a hidden initial state vector for the Xorshift1024star random number generator (= xorshift1024* algorithm), from Integer input argument seed. Argument seed can be given any value (including zero or negative number). The function returns the dummy Integer number id. This number needs to be passed as input to function impureRandom, in order that the sorting order is correct (so that impureRandom is always called after initializeImpureRandom). The function stores a reasonable initial state vector in a C-static memory by using the Xorshift64star random number generator to fill the internal state vector with 64 bit random numbers.
parameter Integer seed; Real r; function random = impureRandom (final id=id); protected Integer id = initializeImpureRandom(seed); equation // Use the random number generator when sample(0,0.001) then r = random(); end when;
Utilities.impureRandom, Random.Generators
function initializeImpureRandom extends Modelica.Icons.Function; input Integer seed "The input seed to initialize the impure random number generator"; output Integer id "Identification number to be passed as input to function impureRandom, in order that sorting is correct"; end initializeImpureRandom;
Date | Description | ||
---|---|---|---|
June 22, 2015 |
|