Method for obtaining the sampler for a empirical_dist object.

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

Arguments

x

The object to obtain the sampler of.

...

Additional arguments to pass (not used).

Value

A function that takes n and returns n resampled observations.

Examples

ed <- empirical_dist(c(10, 20, 30))
s <- sampler(ed)
set.seed(42)
s(5)
#> [1] 10 10 10 10 20