so-un-bot/Ingegneria del Software/0621_12/wrong2.txt

19 lines
674 B
Text
Raw Normal View History

2022-11-14 16:30:34 +01:00
model Env
Integer x; // Pulsante premuto dall'utente (0 nessun pulsante)
Real r1024;
Integer state1024[Modelica.Math.Random.Generators.Xorshift1024star.nState];
algorithm
when initial() then
state1024 := Modelica.Math.Random.Generators.Xorshift1024star.initialState(614657, 30020);
x := 0;
r1024 := 0;
elsewhen sample(0,1) then
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
if (r1024 <= 0.5)
then x := 0;
else
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
if (r1024 <= 0.2) then x := 1; else x:= 0; end if;
end if;
end when;
end Env;