Declares a random variable of type RndBin. With each access, such a variable contains a boolean value that is generated following a binomial (Bernoulli) distribution. The parameter of the RndBin random type specifies the probability of returning true. For example, you can use a random variable using the RndBin random type to specify the probability of running transaction components.
RndBin( in p : float ): boolean;
true or
false
Parameter | Description |
---|---|
p |
Probability of returning true Condition: 0.0 <= p <= 1.0 |
dclrand rEvent1, rEvent2: RndBin(0.25); dcltrans transaction TMain begin if rEvent1 then ... end; while not rEvent2 do ... end; end TMain;
The example shows two random variables with Bernoulli distribution (rEvent1 and rEvent2). In both cases the probability of returning true is 0.25. This means that on average rEvent1 will be set to true in 25% of all cases, and the same applies for rEvent2.
OraSample.bdf, DBApi01.bdf