Celeritas
0.5.0-86+4a8eea4
|
Sample \( 1/x^2 \) over a given domain. More...
#include <InverseSquareDistribution.hh>
Public Types | |
Type aliases | |
using | real_type = RealType |
using | result_type = real_type |
Public Member Functions | |
CELER_FUNCTION | InverseSquareDistribution (real_type a, real_type b) |
Construct on the interval [a, b). More... | |
template<class Generator > | |
CELER_FUNCTION result_type | operator() (Generator &rng) const |
template<class Generator > | |
CELER_FUNCTION auto | operator() (Generator &rng) const -> result_type |
Sample a random number according to the distribution. | |
Sample \( 1/x^2 \) over a given domain.
This distribution is defined on a positive range \( [a, b) \) and has the normalized PDF:
\[ f(x; a, b) = \frac{a b}{x^2 (b - a)} \quad \mathrm{for} \ a \le x < b \]
which integrated into a CDF and inverted gives a sample:
\[ x = \frac{a b}{a + \xi (b - a)} \]
|
inline |
Construct on the interval [a, b).
As with UniformRealDistribution, it is allowable for the two bounds to be out of order.