initializeImpureRandomInitializes the internal state of the impure random number generator |
This information is part of the Modelica Standard Library maintained by the Modelica Association.
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;
seed |
Type: Integer Description: The input seed to initialize the impure random number generator |
---|
id |
Type: Integer Description: Identification number to be passed as input to function impureRandom, in order that sorting is correct |
---|