Skip to contents

Sample from the binomial distribution

Usage

monty_random_binomial(size, prob, state)

monty_random_n_binomial(n_samples, size, prob, state)

Arguments

size

The number of trials

prob

The probability of success on each trial

state

The random number state, from monty_rng_create

n_samples

The number of samples to take, per stream. When using the multiple-sample interface, all other parameters are held constant (per stream).

Value

A vector of random numbers, the same length as the number of streams in state.

Examples

state <- monty_rng_create()
monty_random_binomial(10, 0.3, state)
#> [1] 1
table(monty_random_n_binomial(2000, 10, 0.3, state))
#> 
#>   0   1   2   3   4   5   6   7   8 
#>  55 222 476 532 383 240  65  25   2