Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | List of all members
numeric::random::DistributionSampler< T > Class Template Reference

#include <DistributionSampler.hh>

Inheritance diagram for numeric::random::DistributionSampler< T >:
Inheritance graph
[legend]

Public Member Functions

 DistributionSampler (T &distribution)
 Creates a new instance that allows samples to be drawn randomly from <distribution> More...
 
double sample ()
 Returns a random value drawn from the distribution A general method to generate random numbers from an arbitrary distribution that has a cdf without jumps is to use the inverse function to the cdf: G(y)=F^{-1}(y). If u(1), ..., u(n) are random numbers from the uniform on (0,1) distribution then G(u(1)), ..., G(u(n)) is a random sample from the distribution with cdf F(x). More...
 
const Tdistribution () const
 Returns the distribution from which this sampler generates values. More...
 

Private Attributes

T distribution_
 Distribution from which to draw samples. More...
 

Constructor & Destructor Documentation

template<typename T >
numeric::random::DistributionSampler< T >::DistributionSampler ( T distribution)
inlineexplicit

Creates a new instance that allows samples to be drawn randomly from <distribution>

Member Function Documentation

template<typename T >
const T& numeric::random::DistributionSampler< T >::distribution ( ) const
inline

Returns the distribution from which this sampler generates values.

References numeric::random::DistributionSampler< T >::distribution_.

Referenced by numeric::random::DistributionSampler< T >::sample().

template<typename T >
double numeric::random::DistributionSampler< T >::sample ( )
inline

Returns a random value drawn from the distribution A general method to generate random numbers from an arbitrary distribution that has a cdf without jumps is to use the inverse function to the cdf: G(y)=F^{-1}(y). If u(1), ..., u(n) are random numbers from the uniform on (0,1) distribution then G(u(1)), ..., G(u(n)) is a random sample from the distribution with cdf F(x).

References numeric::random::DistributionSampler< T >::distribution(), and numeric::random::uniform().

Member Data Documentation

template<typename T >
T numeric::random::DistributionSampler< T >::distribution_
private

Distribution from which to draw samples.

Referenced by numeric::random::DistributionSampler< T >::distribution().


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