AnyLogic
Expand
Font size

randomTrue

Returns true with the given probability p. Is equivalent to uniform() < p. The probability of false is 1 - p correspondingly.

randomTrue(double p)

Parameters
Name Type Description
p double The probability of true.
Result
Type Description
boolean true with probability p, false with probability 1 - p.

randomTrue(double p, java.util.Random r)

Returns true with the given probability p, using the specified random number generator.

Parameters
Name Type Description
p double The probability of true.
r java.util.Random The random number generator.
Result
Type Description
boolean true with probability p, false with probability 1 - p.
How can we improve this article?