Celeritas  0.5.0-86+4a8eea4
Public Member Functions | List of all members
celeritas::UniformRealDistribution< RealType > Class Template Reference

Sample from a uniform distribution. More...

#include <UniformRealDistribution.hh>

Public Types

Type aliases
using real_type = RealType
 
using result_type = real_type
 

Public Member Functions

CELER_FUNCTION UniformRealDistribution ()
 Construct on the interval [0, 1). More...
 
CELER_FUNCTION UniformRealDistribution (real_type a, real_type b)
 Construct on the interval [a, b).
 
template<class Generator >
CELER_FUNCTION result_type operator() (Generator &rng) const
 
CELER_FUNCTION real_type a () const
 Get the lower bound of the distribution.
 
CELER_FUNCTION real_type b () const
 Get the upper bound of the distribution.
 
template<class Generator >
CELER_FUNCTION auto operator() (Generator &rng) const -> result_type
 Sample a random number according to the distribution.
 

Detailed Description

template<class RealType = ::celeritas::real_type>
class celeritas::UniformRealDistribution< RealType >

Sample from a uniform distribution.

This distribution is defined between two arbitrary real numbers a and b , and has a flat PDF between the two values. It is allowable for the two numbers to have reversed order. The normalized PDF is:

\[ f(x; a, b) = \frac{1}{b - a} \quad \mathrm{for} \ a \le x < b \]

which integrated into a CDF and inverted gives a sample:

\[ x = (b - a) \xi + a \]

Constructor & Destructor Documentation

◆ UniformRealDistribution()

template<class RealType >
CELER_FUNCTION celeritas::UniformRealDistribution< RealType >::UniformRealDistribution
inline

Construct on the interval [0, 1).

This constructor is generally unused because it's simpler and more efficient to directly call generate_canonical. We leave it for compatibility with the standard.


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