4.4.1
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends
fcppt::random::distribution::basic< Parameters > Class Template Reference

Detailed Description

template<typename Parameters>
class fcppt::random::distribution::basic< Parameters >

A wrapper for distributions.

A wrapped for distributions that draws its properties from Parameters. The capabilities provided by this class are almost the same as the random distribution requirements by the standard except it lacks a default constructor.

Template Parameters
ParametersMust be a class from fcppt::random::distribution::parameters

Public Types

using distribution_type = basic
 A self typedef required by the standard.
 
using wrapped_distribution = typename Parameters::distribution
 The underlying distribution used.
 
using result_type = typename Parameters::result_type
 The result type of applying this distribution.
 
using param_type = Parameters
 The parameters type, required by the standard.
 

Public Member Functions

 basic (param_type const &parameters)
 Constructs the distribution from the parameters type.
 
template<typename T1 , typename T2 >
 basic (T1 const &p1, T2 const &p2)
 Constructs the distribution from multiple parameters.
 
void reset ()
 Resets the underlying distribution.
 
param_type param () const
 Returns the parameters used to construct the distribution.
 
void param (param_type const &parameters)
 Supplies new parameters to the distribution.
 
template<typename Rng >
result_type operator() (Rng &generator)
 Draws a random number.
 
template<typename Rng >
result_type operator() (Rng &generator, param_type const &parameters)
 Draws a random number with parameters.
 
result_type min () const
 The minimum value that can be produced.
 
result_type max () const
 The maximum value that can be produced.
 
wrapped_distribution const & distribution () const
 The underlying distribution.
 

Friends

template<typename Ch , typename Traits >
std::basic_istream< Ch, Traits > operator>> (std::basic_istream< Ch, Traits >, basic &)
 

Member Typedef Documentation

◆ distribution_type

template<typename Parameters >
using fcppt::random::distribution::basic< Parameters >::distribution_type = basic

A self typedef required by the standard.

◆ param_type

template<typename Parameters >
using fcppt::random::distribution::basic< Parameters >::param_type = Parameters

The parameters type, required by the standard.

◆ result_type

template<typename Parameters >
using fcppt::random::distribution::basic< Parameters >::result_type = typename Parameters::result_type

The result type of applying this distribution.

◆ wrapped_distribution

template<typename Parameters >
using fcppt::random::distribution::basic< Parameters >::wrapped_distribution = typename Parameters::distribution

The underlying distribution used.

Constructor & Destructor Documentation

◆ basic() [1/2]

template<typename Parameters >
fcppt::random::distribution::basic< Parameters >::basic ( param_type const &  parameters)
explicit

Constructs the distribution from the parameters type.

Constructs the distribution from parameters

Parameters
parametersThe parameters to use

◆ basic() [2/2]

template<typename Parameters >
template<typename T1 , typename T2 >
fcppt::random::distribution::basic< Parameters >::basic ( T1 const &  p1,
T2 const &  p2 
)

Constructs the distribution from multiple parameters.

Constructs the distribution from p1 and p2, calling param_type(p1,p2)

Note
This should really be replaced by a variadic template
Parameters
p1The first parameter
p2The second parameter
Template Parameters
T1A type compatible to the first parameter of param_type
T2A type compatible to the second parameter of param_type

Member Function Documentation

◆ distribution()

template<typename Parameters >
wrapped_distribution const & fcppt::random::distribution::basic< Parameters >::distribution ( ) const

The underlying distribution.

◆ max()

template<typename Parameters >
result_type fcppt::random::distribution::basic< Parameters >::max ( ) const

The maximum value that can be produced.

◆ min()

template<typename Parameters >
result_type fcppt::random::distribution::basic< Parameters >::min ( ) const

The minimum value that can be produced.

◆ operator()() [1/2]

template<typename Parameters >
template<typename Rng >
result_type fcppt::random::distribution::basic< Parameters >::operator() ( Rng &  generator)

Draws a random number.

Draws a random number from the underlying distribution by using generator

Template Parameters
RngMust be a random generator
Parameters
generatorThe random generator to use

◆ operator()() [2/2]

template<typename Parameters >
template<typename Rng >
result_type fcppt::random::distribution::basic< Parameters >::operator() ( Rng &  generator,
param_type const &  parameters 
)

Draws a random number with parameters.

Draws a random number from the underlying distribution by using generator and parameters

Template Parameters
RngMust be a random generator
Parameters
generatorThe random generator to use
parametersThe parameters to use

◆ param() [1/2]

template<typename Parameters >
param_type fcppt::random::distribution::basic< Parameters >::param ( ) const

Returns the parameters used to construct the distribution.

◆ param() [2/2]

template<typename Parameters >
void fcppt::random::distribution::basic< Parameters >::param ( param_type const &  parameters)

Supplies new parameters to the distribution.

Supplies the new parameters parameters to the distribution.

Parameters
parametersThe new parameters to use

◆ reset()

template<typename Parameters >
void fcppt::random::distribution::basic< Parameters >::reset ( )

Resets the underlying distribution.

Friends And Related Symbol Documentation

◆ operator>>

template<typename Parameters >
template<typename Ch , typename Traits >
std::basic_istream< Ch, Traits > operator>> ( std::basic_istream< Ch, Traits >  ,
basic< Parameters > &   
)
friend