Returns a given number of points sampled from the distribution.

rand(object, n, simplify = TRUE)

Arguments

object

Distribution.

n

number of observations. If length(n) > 1, the length is taken to be the number required.

simplify

if TRUE (default) returns results in simplest form (vector or data.table) otherwise as data.table.

Value

Simulated draws from the distribution as either a numeric if simplify is TRUE or as a data.table.

Details

If available a rand will be returned without warning using an analytic expression. Otherwise, if the distribution has not been decorated with FunctionImputation, NULL is returned. To impute the rand, use decorate(distribution, FunctionImputation), this will provide a numeric calculation for the rand with warning.

Additional named arguments can be passed, which are required for composite distributions such as ProductDistribution and ArrayDistribution.

R6 Usage

$rand(n, simplify = TRUE)

See also

pdf, cdf, quantile for other statistical functions. FunctionImputation, decorate for imputing missing functions.