num::categorical_sampling¶
Defined in header <stochastic/concepts.hpp>
template <class S, class G>
concept categorical_sampling =
std::uniform_random_bit_generator<G> && requires(S &sampler, G &rng) {
{ sampler(rng) } -> std::convertible_to<idx>;
};
Sampler that draws index \(k\) with probability \(w_k / \sum_j w_j\), \(w_k \ge 0\).