rippled
Public Member Functions | Private Attributes | List of all members
ripple::test::csf::Selector< RAIter, Generator > Class Template Reference

Invocable that returns random samples from a range according to a discrete distribution. More...

Collaboration diagram for ripple::test::csf::Selector< RAIter, Generator >:
Collaboration graph
[legend]

Public Member Functions

 Selector (RAIter first, RAIter last, std::vector< double > const &w, Generator &g)
 Constructor. More...
 
std::iterator_traits< RAIter >::value_type operator() ()
 

Private Attributes

RAIter first_
 
RAIter last_
 
std::discrete_distribution dd_
 
Generator g_
 

Detailed Description

template<class RAIter, class Generator>
class ripple::test::csf::Selector< RAIter, Generator >

Invocable that returns random samples from a range according to a discrete distribution.

Given a pair of random access iterators begin and end, each call to the instance of Selector returns a random entry in the range (begin,end) according to the weights provided at construction.

Definition at line 81 of file test/csf/random.h.

Constructor & Destructor Documentation

◆ Selector()

template<class RAIter , class Generator >
ripple::test::csf::Selector< RAIter, Generator >::Selector ( RAIter  first,
RAIter  last,
std::vector< double > const &  w,
Generator &  g 
)

Constructor.

Parameters
firstRandom access iterator to the start of the range
lastRandom access iterator to the end of the range
wVector of weights of size list-first
gthe pseudo-random number generator

Definition at line 94 of file test/csf/random.h.

Member Function Documentation

◆ operator()()

template<class RAIter , class Generator >
std::iterator_traits<RAIter>::value_type ripple::test::csf::Selector< RAIter, Generator >::operator() ( )

Definition at line 109 of file test/csf/random.h.

Member Data Documentation

◆ first_

template<class RAIter , class Generator >
RAIter ripple::test::csf::Selector< RAIter, Generator >::first_
private

Definition at line 83 of file test/csf/random.h.

◆ last_

template<class RAIter , class Generator >
RAIter ripple::test::csf::Selector< RAIter, Generator >::last_
private

Definition at line 83 of file test/csf/random.h.

◆ dd_

template<class RAIter , class Generator >
std::discrete_distribution ripple::test::csf::Selector< RAIter, Generator >::dd_
private

Definition at line 84 of file test/csf/random.h.

◆ g_

template<class RAIter , class Generator >
Generator ripple::test::csf::Selector< RAIter, Generator >::g_
private

Definition at line 85 of file test/csf/random.h.