.DESLib.RandomLib.Variates.Discrete.Bernoulli

Information

Bernoulli

Bernoulli probability distribution.

Syntax

Bernoulli(g,p)

Description

Generates a random variate following the Bernoulli probability distribution with probability p.

The pseudo-code algorithm used for this distribution is:

1. Generate u as U(0,1).
2. If u &le p, return x = 1. Otherwise, return x = 0.

Examples

(u,g) := Bernoulli(g,0.4);

Interface

function Bernoulli
  extends Var;
end Bernoulli;

Generated at 2024-11-21T19:25:40Z by OpenModelicaOpenModelica 1.24.2 using GenerateDoc.mos