Returns a function that draws n independent samples from the Poisson distribution.

# S3 method for class 'poisson_dist'
sampler(x, ...)

Arguments

x

A poisson_dist object.

...

Additional arguments (not used).

Value

A function function(n = 1, ...) returning an integer vector of length n.

Examples

x <- poisson_dist(5)
s <- sampler(x)
set.seed(42)
s(5)
#> [1] 8 9 4 7 6