Used to sample floating-point values from a normal(-/gaussian) distribution.
More...
#include <NormalReal.hpp>
|
| constexpr | NormalReal (T_Result mean=T_Result{0}, T_Result stdDev=T_Result{1}) |
| | Constructs normal(-/gaussian) distribution with given parameters.
|
| template<concepts::UniformStdEngine T_Engine> |
| constexpr result_type | operator() (T_Engine &engine) |
| | Selects a value from a normal (-/gaussian) distribution for the configured (mean,stdDev) settings.
|
template<std::floating_point T_Result>
struct alpaka::rand::distribution::NormalReal< T_Result >
Used to sample floating-point values from a normal(-/gaussian) distribution.
Usage is analogous to std::normal_distribution<T_Result>
- See also
- https://en.cppreference.com/w/cpp/numeric/random/normal_distribution.html -> Generates N(mean, stddev). Is using the Box-Muller method of generating normally distributed random numbers from a uniform distribution.
- Note
- : currently supports 32 and 64 bit floating point types.
Definition at line 73 of file NormalReal.hpp.
◆ result_type
template<std::floating_point T_Result>
◆ T_Impl
template<std::floating_point T_Result>
◆ NormalReal()
template<std::floating_point T_Result>
Constructs normal(-/gaussian) distribution with given parameters.
- Parameters
-
| mean | Mean of the target normal distribution. |
| stdDev | Standard deviation of the target normal distribution. |
The default is N(0,1). The distribution is sampled using the Box-Muller method. This implementation keeps an internal state, therefore each thread/worker must use its own instance to avoid data races when the same object is accessed concurrently by multiple workers.
Usage is otherwise analogous to std::normal_distribution<T_Result>
- See also
- https://en.cppreference.com/w/cpp/numeric/random/normal_distribution.html
Definition at line 92 of file NormalReal.hpp.
◆ operator()()
template<std::floating_point T_Result>
template<concepts::UniformStdEngine T_Engine>
Selects a value from a normal (-/gaussian) distribution for the configured (mean,stdDev) settings.
- Parameters
-
| engine | a random engine conforming to the UniformRandomEngine concept (currently accepts stdlib uniform engines and alpaka engines included in the alpaka::rand::engine namespace) |
- Returns
- a floating-point value sampled from the configured distribution.
Definition at line 105 of file NormalReal.hpp.
◆ m_impl
template<std::floating_point T_Result>
◆ m_mean
template<std::floating_point T_Result>
◆ m_stdDev
template<std::floating_point T_Result>
The documentation for this struct was generated from the following file:
- /home/docs/checkouts/readthedocs.org/user_builds/alpaka3/checkouts/latest/include/alpaka/rand/distribution/NormalReal.hpp