20 #ifndef ANTKEEPER_GAME_ANT_GENE_FREQUENCY_TABLE_HPP
21 #define ANTKEEPER_GAME_ANT_GENE_FREQUENCY_TABLE_HPP
36 std::vector<std::shared_ptr<T>>
genes;
51 [[nodiscard]] std::shared_ptr<T>
sample(URBG& urbg)
const
58 std::discrete_distribution<std::size_t> distribution(
weights.begin(),
weights.end());
60 return genes[distribution(urbg)];
Ant gene frequency table.
std::vector< std::shared_ptr< T > > genes
Gene array.
std::vector< float > weights
Weight array.
std::shared_ptr< T > sample(URBG &urbg) const
Samples a gene from the frequency table.