Method to sample from an exponential object.
# S3 method for class 'exponential'
sampler(x, ...)A function that allows sampling from the exponential
distribution. Accepts an argument n denoting sample
size and rate denoting the failure rate. Defaults to
the failure rate of object x.
x <- exponential(rate = 2)
s <- sampler(x)
set.seed(42)
s(5)
#> [1] 0.09916841 0.33044763 0.14174552 0.01909595 0.23658831