It creates a sampler for the x object. It returns a function
that accepts a parameter n denoting the number of samples
to draw from the x object and also any additional parameters
... are passed to the generated function.
sampler(x, ...)A function that takes n and returns n samples.