realize draws n samples from a distribution and wraps
them in an empirical_dist.
This is the universal fallback that lets any dist object be
converted to a discrete approximation on which methods like
cdf, density, and conditional
are always available.
realize(x, n = 10000, ...)
# S3 method for class 'dist'
realize(x, n = 10000, ...)
# S3 method for class 'empirical_dist'
realize(x, ...)
# S3 method for class 'realized_dist'
realize(x, n = 10000, ...)An empirical_dist (or realized_dist)
object.
For non-empirical distributions, the result is a
realized_dist that preserves the source distribution
as provenance metadata. This enables re-sampling via
realize(x$source, n = ...) and informative printing.
The empirical_dist method is a no-op: the distribution is
already materialized.
The realized_dist method re-samples from the original source
distribution, allowing cheap regeneration with a different sample size.