19template <
class T,
class G>
25 for (
int i = 0; i < v.
size() - 1; ++i)
44template <
class RandomNumberDistribution,
class Generator>
60template <
class RAIter,
class Generator>
80 "Selector only supports random access iterators.");
92template <
typename Iter,
typename Generator>
93Selector<Iter, Generator>
113 template <
class Generator>
142 template <
class Generator>
Constant "distribution" that always returns the same value.
ConstantDistribution(double const &t)
double operator()(Generator &)
Power-law distribution with PDF.
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 > random_weighted_shuffle(std::vector< T > v, std::vector< double > w, G &g)
Return a randomly shuffled copy of vector based on weights w.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.