Skip to content

num::sample_multinomial

Defined in header <stochastic/multinomial.hpp>

template <std::uniform_random_bit_generator RNG>
array<idx> sample_multinomial(view<const real> weights, idx draws, RNG &random);

Draw multinomial counts \(n_k\) with \(P(k) \propto w_k\). The counts sum to draws.