class
RNGRandom number generator.
Contents
This class uses runtime polymorphism without client-side inheritance: inheritance is confined to the internals of the this class, invisible to client-code. The class exclusively deals with ownership enabling client-side value semantics. Credit goes to Sean Parent at Adobe: https:/
Constructors, destructors, conversion operators
-
template<typename T>RNG(T x) explicit
- Constructor taking an object modeling Concept.
-
template<typename T>RNG(std::function<T()> x) explicit
- Constructor taking a function pointer to a constructor of an object modeling Concept.
- RNG(const RNG& x)
- Copy constructor.
- RNG(RNG&&) noexcept defaulted
- Move constructor.
Public functions
-
void uniform(int stream,
ncomp_
t num, double* r) const - Public interface to uniform RNG.
-
void gaussian(int stream,
ncomp_
t num, double* r) const - Public interface to Gaussian RNG.
-
void gaussianmv(int stream,
ncomp_
t num, ncomp_ t d, const double*const mean, const double*const cov, double* r) const - Public interface to multi-variate Gaussian RNG.
-
void beta(int stream,
ncomp_
t num, double p, double q, double a, double b, double* r) const - Public interface to beta RNG.
-
void gamma(int stream,
ncomp_
t num, double a, double b, double* r) const - Public interface to gamma RNG.
- auto nthreads() const -> std::size_t noexcept
- Public interface to number of threads accessor.
- auto operator=(const RNG& x) -> RNG&
- Copy assignment.
- auto operator=(RNG&&) noexcept -> RNG& defaulted
- Move assignment.
Function documentation
template<typename T>
tk:: RNG:: RNG(std::function<T()> x) explicit
Constructor taking a function pointer to a constructor of an object modeling Concept.
Parameters | |
---|---|
x in | Function pointer to a constructor of an object modeling Concept |
Passing std::function allows late execution of the constructor, i.e., as late as inside this class' constructor, and thus usage from a factory.