1#ifndef XRPL_TEST_CSF_RANDOM_H_INCLUDED
2#define XRPL_TEST_CSF_RANDOM_H_INCLUDED
20template <
class T,
class G>
26 for (
int i = 0; i < v.
size() - 1; ++i)
45template <
class RandomNumberDistribution,
class Generator>
61template <
class RAIter,
class Generator>
85 "Selector only supports random access iterators.");
97template <
typename Iter,
typename Generator>
98Selector<Iter, Generator>
118 template <
class Generator>
147 template <
class Generator>
Constant "distribution" that always returns the same value.
double operator()(Generator &)
ConstantDistribution(double const &t)
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.
Selector(RAIter first, RAIter last, std::vector< double > const &w, Generator &g)
Constructor.
std::iterator_traits< RAIter >::value_type operator()()
std::discrete_distribution dd_
Selector< Iter, Generator > makeSelector(Iter first, Iter last, std::vector< double > const &w, Generator &g)
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::vector< typename RandomNumberDistribution::result_type > sample(std::size_t size, RandomNumberDistribution dist, Generator &g)
Generate a vector of random samples.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.