Template Function Aux::Random::weightedChoice

Function Documentation

template<typename Element>
const Element &Aux::Random::weightedChoice(const std::vector<std::pair<Element, double>> &weightedElements)
Returns:

a weighted random choice from a vector of elements with given weights.