rvbern: Sample a vector of Bernoulli variables.

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Sample a vector of Bernoulli variables with higher speed (same length with "p"). The Bernoulli random variables can have different means.

Usage

1
rvbern(p)

Arguments

p

A vector of probabilities, each being the head probability of an independent coin toss

Value

A vector of 1s (head) and 0s (tail)

Examples

1
rvbern(c(0.9,0.1,0.2,0.3))

baker documentation built on Feb. 2, 2022, 9:06 a.m.