Expand description
Vose’s alias method for O(1) sampling from discrete distributions.
Given N outcomes with associated weights, an alias table pre-computes a structure that allows selecting an outcome in constant time from a single uniform u64 input.
Two variants:
AliasTable<T>: generic, works with anyCloneoutcome type.AliasTableU64: flat parallel arrays, optimized for the Phase 2 compiled kernel path where outcomes are indices 0..N.
Structs§
- Alias
Sample - Sample an outcome index from a pre-built alias table over
weights. The input is a uniform u64 (hash upstream for pseudo-random dispersion); the output is the chosen outcome index. - Alias
Table - Generic alias table for O(1) weighted sampling.
- Alias
Table U64 - Alias table optimized for u64 outcomes (indices 0..N).