2022-11-16 17:56:16 +01:00
|
|
|
<pre>
|
2022-11-15 14:27:16 +01:00
|
|
|
model System
|
2022-11-16 17:56:16 +01:00
|
|
|
Integer y; Real r1024;
|
2022-11-15 14:27:16 +01:00
|
|
|
Integer state1024[Modelica.Math.Random.Generators.Xorshift1024star.nState];
|
|
|
|
equation
|
2022-11-16 17:56:16 +01:00
|
|
|
y = if (r1024 <= 0.3) then 0 else 1;
|
2022-11-15 14:27:16 +01:00
|
|
|
algorithm
|
|
|
|
when initial() then
|
|
|
|
state1024 := Modelica.Math.Random.Generators.Xorshift1024star.initialState(614657, 30020);
|
|
|
|
r1024 := 0;
|
|
|
|
elsewhen sample(0,1) then
|
|
|
|
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
|
|
|
|
end when;
|
2022-11-16 17:56:16 +01:00
|
|
|
end System;
|
|
|
|
</pre>
|