Description Usage Arguments Details Value Note Author(s) References See Also Examples
The function rbernou generates Bernoulli Random Variables faster than using rbinom(n, 1, prob)
or runif(n) <= prob
by using a C-level integer comparison.
1 | rbernou(n, prob=0.5)
|
n |
integer, number of simulations. |
prob |
double, probability. |
The case prob = 0.5
is twice time faster than the general case 0 <= proba <= 1
, using a specific C-level binary algorithm.
A vector of i.i.d. Bernoulli random variables.
For a big number of simulations, it is approximately eleven times faster than the usual rbinom(n, 1, prob)
.
Nicolas Baradel - PGM Solutions
https://en.wikipedia.org/wiki/Bernoulli_distribution
http://pgm-solutions.com/packages
1 | rbernou(5)
|
[1] 1 1 1 0 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.