sample_enum.RdThis is a wrapper around [sample()] to make selecting random enum values easier.
sample_enum(enum_type, size, replace = FALSE, weight = NULL)
| enum_type | Object that passes [is.enum_type()] check. |
|---|---|
| size | A non-negative integer giving number of items to choose. |
| replace | Should sampling be with replacement? |
| weight | Sampling weights. This must evaluate to a vector of non-negative numbers the same length as the input. Weights are automatically standardised to sum to 1. |
A list of enum values of length size drawn from enum_type's values.