20 #ifndef RIPPLE_TEST_CSF_RANDOM_H_INCLUDED
21 #define RIPPLE_TEST_CSF_RANDOM_H_INCLUDED
39 template <
class T,
class G>
45 for (
int i = 0; i < v.
size() - 1; ++i)
64 template <
class RandomNumberDistribution,
class Generator>
80 template <
class RAIter,
class Generator>
104 "Selector only supports random access iterators.");
116 template <
typename Iter,
typename Generator>
117 Selector<Iter, Generator>
137 template <
class Generator>
166 template <
class Generator>
std::vector< typename RandomNumberDistribution::result_type > sample(std::size_t size, RandomNumberDistribution dist, Generator &g)
Generate a vector of random samples.
Selector< Iter, Generator > makeSelector(Iter first, Iter last, std::vector< double > const &w, Generator &g)
std::uniform_real_distribution< double > uf_
Invocable that returns random samples from a range according to a discrete distribution.
PowerLawDistribution(double xmin, double a)
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.
std::discrete_distribution dd_
double operator()(Generator &)
Power-law distribution with PDF.
double operator()(Generator &g)
ConstantDistribution(double const &t)
Constant "distribution" that always returns the same value.
std::iterator_traits< RAIter >::value_type operator()()
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Selector(RAIter first, RAIter last, std::vector< double > const &w, Generator &g)
Constructor.