17template <
class T,
class G>
23 for (
int i = 0; i < v.
size() - 1; ++i)
42template <
class RandomNumberDistribution,
class Generator>
58template <
class RAIter,
class Generator>
78 "Selector only supports random access iterators.");
90template <
typename Iter,
typename Generator>
91Selector<Iter, Generator>
111 template <
class Generator>
140 template <
class Generator>
ConstantDistribution(double const &t)
double operator()(Generator &)
PowerLawDistribution(double xmin, double a)
double operator()(Generator &g)
std::uniform_real_distribution< double > uf_
Invocable that returns random samples from a range according to a discrete distribution.
std::discrete_distribution dd_
std::iterator_traits< RAIter >::value_type operator()()
Selector(RAIter first, RAIter last, std::vector< double > const &w, Generator &g)
Constructor.
Selector< Iter, Generator > makeSelector(Iter first, Iter last, std::vector< double > const &w, Generator &g)
std::vector< typename RandomNumberDistribution::result_type > sample(std::size_t size, RandomNumberDistribution dist, Generator &g)
Generate a vector of random samples.
std::vector< T > randomWeightedShuffle(std::vector< T > v, std::vector< double > w, G &g)
Return a randomly shuffled copy of vector based on weights w.