Alias Table
An STAliasTable
is a precomputed struct for sampling with replacement. Once computed, it's the fastest possible method for sampling.
Alias tables can be constructed in blueprint from Sum Arrays, weights, or probabilities. Unlike Sum Arrays and Sum Trees, alias tables don't expose functions for editing after construction.
Functions for alias tables are exposed to blueprint under the namespace 'Stoch.Utils.AliasTable'.
Currently, Alias Tables are not editable in details views.
Uses
Alias Tables are used internally by unlimited distributions.
Advanced
For how it works, see the wikipedia article.
Precision
Precision is limited to DBL_EPSILON
, or 1 / 2^52. Probabilities with greater precision will be discretized into buckets of DBL_EPSILON
. As a consequence, the lowest possible probability is about 1 in 4.5 quadrillion.
Attempting to use probabilities lower than DBL_EPSILON
may cause the item to never be sampled. It's up to the user to ensure this does not happen.