functionBinomial
Binomial
Extends from Var (prototype for variate generation functions).
Information
Binomial
Binomial probability distribution.
Syntax
Binomial(g,t,b)
Description
Generates a random variate following a Binomial(t,p) probability distribution. This distribution is the sum of t random variables from the Bernoulli(b) distribution.
The pseudo-code algorithm used for this distribution is:
1. Generate y[1],...,y[t] as IID Bernoulli(p).
2. Return x = y[1]+...+y[t]
Examples
(u,g) := Binomial(g,4,0.3);
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| Generator | g (from Var) | Random number generator | |
| Real | a (from Var) | 0 | First parameter of the prob. distribution |
| Real | b (from Var) | 0 | Second parameter of the prob. distribution |
| Real | c (from Var) | 0 | Third parameter of the prob. distribution (only for the Johnson and Triangular distributions) |
| Real | d (from Var) | 0 | Fourth parameter of the prob. distribution (only for the Johnson distribution) |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Real | x (from Var) | Generated random variate | |
| Generator | gout (from Var) | Updated random number generator |