Vcsn  2.0
Be Rational
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
vcsn::random_selector< RandomGenerator > Struct Template Reference

#include <random.hh>

Collaboration diagram for vcsn::random_selector< RandomGenerator >:

Public Member Functions

 random_selector (const RandomGenerator &g=RandomGenerator())
 
template<typename Iter >
Iter select (Iter start, Iter end)
 A randomly selected iterator in [start, end). More...
 
template<typename Iter >
Iter operator() (Iter start, Iter end)
 A randomly selected iterator in [start, end). More...
 
template<typename Container >
auto operator() (const Container &c) -> decltype(*std::begin(c))
 A randomly selected member of c. More...
 
template<typename Container >
auto pop (Container &c) -> typename Container::value_type
 A randomly selected member of c. Remove it from c. More...
 

Private Attributes

RandomGenerator gen_
 

Detailed Description

template<typename RandomGenerator = std::default_random_engine>
struct vcsn::random_selector< RandomGenerator >

Definition at line 14 of file random.hh.

Constructor & Destructor Documentation

template<typename RandomGenerator = std::default_random_engine>
vcsn::random_selector< RandomGenerator >::random_selector ( const RandomGenerator &  g = RandomGenerator())
inline

Definition at line 16 of file random.hh.

Member Function Documentation

template<typename RandomGenerator = std::default_random_engine>
template<typename Iter >
Iter vcsn::random_selector< RandomGenerator >::operator() ( Iter  start,
Iter  end 
)
inline

A randomly selected iterator in [start, end).

Definition at line 31 of file random.hh.

References vcsn::random_selector< RandomGenerator >::select().

Here is the call graph for this function:

template<typename RandomGenerator = std::default_random_engine>
template<typename Container >
auto vcsn::random_selector< RandomGenerator >::operator() ( const Container &  c) -> decltype(*std::begin(c))
inline

A randomly selected member of c.

Definition at line 38 of file random.hh.

References vcsn::random_selector< RandomGenerator >::select().

Here is the call graph for this function:

template<typename RandomGenerator = std::default_random_engine>
template<typename Container >
auto vcsn::random_selector< RandomGenerator >::pop ( Container &  c) -> typename Container::value_type
inline

A randomly selected member of c. Remove it from c.

Definition at line 45 of file random.hh.

References vcsn::random_selector< RandomGenerator >::select().

Referenced by vcsn::random().

Here is the call graph for this function:

template<typename RandomGenerator = std::default_random_engine>
template<typename Iter >
Iter vcsn::random_selector< RandomGenerator >::select ( Iter  start,
Iter  end 
)
inline

A randomly selected iterator in [start, end).

Definition at line 22 of file random.hh.

References vcsn::random_selector< RandomGenerator >::gen_.

Referenced by vcsn::random_selector< RandomGenerator >::operator()(), and vcsn::random_selector< RandomGenerator >::pop().

Member Data Documentation

template<typename RandomGenerator = std::default_random_engine>
RandomGenerator vcsn::random_selector< RandomGenerator >::gen_
private

Definition at line 54 of file random.hh.

Referenced by vcsn::random_selector< RandomGenerator >::select().


The documentation for this struct was generated from the following file: