Samples from a binomial distribution with \(n\) trials and success probability \(p\).
When size = 1 (the default), this is a Bernoulli distribution.
See also
Other rng:
nv_normal,
nv_rng_state(),
nv_runif(),
nv_sample(),
nv_sample_int()
Examples
state <- nv_rng_state(42L)
# Bernoulli samples
result <- nv_rbinom(c(2, 3), state)
result[[2]]
#> AnvlArray
#> 0 0 1
#> 0 1 1
#> [ CPUi32{2,3} ]