fpmas 1.6
Public Member Functions | List of all members
fpmas::random::DiscreteDistribution< IntType > Class Template Reference

#include <distribution.h>

Inheritance diagram for fpmas::random::DiscreteDistribution< IntType >:
Inheritance graph
[legend]
Collaboration diagram for fpmas::random::DiscreteDistribution< IntType >:
Collaboration graph
[legend]

Public Member Functions

template<typename Container >
 DiscreteDistribution (const Container &c)
 
- Public Member Functions inherited from fpmas::random::Distribution< std::discrete_distribution< std::size_t > >
 Distribution (Args... args)
 
result_type operator() (Generator_t &generator)
 
result_type min () const override
 
result_type max () const override
 
virtual Distribution_t::result_type min () const=0
 
virtual Distribution_t::result_type max () const=0
 

Additional Inherited Members

- Public Types inherited from fpmas::random::Distribution< std::discrete_distribution< std::size_t > >
typedef Distribution_t::result_type result_type
 

Detailed Description

template<typename IntType = std::size_t>
class fpmas::random::DiscreteDistribution< IntType >

Predefined DiscreteDistribution.

The purpose of the discrete distribution is to select an integer i in the range [0, n) such as P(i) = w_i / N, with w_i the weight associated to i and N the total wheights sum.

The weight list can be provided to the constructor as a container (std::vector, std::list...) of as a pair of begin(), end() iterators.

Constructor & Destructor Documentation

◆ DiscreteDistribution()

template<typename IntType = std::size_t>
template<typename Container >
fpmas::random::DiscreteDistribution< IntType >::DiscreteDistribution ( const Container &  c)
inline

Constructs a DiscreteDistribution from weights contained in the specified container.

Parameters
cweights list

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