Iam new to anylogic. I want to generate random true false results to control parameter in Select Output.
I used this if else conditions in my source
if(randomTrue(0.25)){
if(randomTrue(0.5)){
agent.isOnlineRezerve = true;
}else {
agent.isOnlineRezerve = false;
}
}else{
agent.isOnlineRezerve = false;
}
My condition of source output is
agent.isOnlineRezerve
Every time I run it it gives me 128 out of 1000 true and the rest false
I want to get a number other than 128 each time, but I couldn’t do it. I would be glad if you help.
>Solution :
AnyLogic is using a fixed seed to the random number generator, so that independent runs produce equivalent results. To switch to a random seed:
To set up random number generator seed
In the Projects view, select the experiment you are currently working with.
Go to the Randomness section of the Properties view.
In the Random number generation group of buttons:
To set random seed, choose the Random seed (unique experiments) option.
To set fixed seed, choose the Fixed seed (reproducible experiments) option > and enter the seed value in the Seed value edit box.
From https://anylogic.help/anylogic/stochastic/random-number-generator.html