Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
WeightedSelectionConfig< T, N > Class Template Reference

#include <weighted_selection.hpp>

Public Member Functions

constexpr WeightedSelectionConfig (const std::array< std::pair< T, size_t >, N > &options_with_weights)
 
constexpr WeightedSelectionConfig (std::initializer_list< std::pair< T, size_t > > options_with_weights)
 
select (std::mt19937_64 &rng) const
 

Private Attributes

std::array< std::pair< T, size_t >, N > options_with_weights
 
size_t total_weight = 0
 

Detailed Description

template<typename T, size_t N>
class WeightedSelectionConfig< T, N >

Definition at line 8 of file weighted_selection.hpp.

Constructor & Destructor Documentation

◆ WeightedSelectionConfig() [1/2]

template<typename T , size_t N>
constexpr WeightedSelectionConfig< T, N >::WeightedSelectionConfig ( const std::array< std::pair< T, size_t >, N > &  options_with_weights)
inlineconstexpr

Definition at line 14 of file weighted_selection.hpp.

◆ WeightedSelectionConfig() [2/2]

template<typename T , size_t N>
constexpr WeightedSelectionConfig< T, N >::WeightedSelectionConfig ( std::initializer_list< std::pair< T, size_t > >  options_with_weights)
inlineconstexpr

Definition at line 22 of file weighted_selection.hpp.

Member Function Documentation

◆ select()

template<typename T , size_t N>
T WeightedSelectionConfig< T, N >::select ( std::mt19937_64 rng) const
inline

Definition at line 33 of file weighted_selection.hpp.

Member Data Documentation

◆ options_with_weights

template<typename T , size_t N>
std::array<std::pair<T, size_t>, N> WeightedSelectionConfig< T, N >::options_with_weights
private

Definition at line 10 of file weighted_selection.hpp.

◆ total_weight

template<typename T , size_t N>
size_t WeightedSelectionConfig< T, N >::total_weight = 0
private

Definition at line 11 of file weighted_selection.hpp.


The documentation for this class was generated from the following file: