mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches

Random number generation.

Classes

class  mx::math::randomT< typeT, _ranengT, _randistT >
 A random number type, which functions like any other arithmetic type. More...
class  mx::math::laplace_distribution< _RealType >
 The Laplace (double exponential) continuous distribution for random numbers. More...

Functions

template<typename intT>
int mx::math::randomSeed (intT &seedval)
 Get a value to use as a random seed.
template<typename realT>
using mx::math::uniDistT = randomT<realT, std::mt19937_64, std::uniform_real_distribution<realT>>
 Alias for a uniform random variate.
template<typename realT>
using mx::math::normDistT = randomT<realT, std::mt19937_64, std::normal_distribution<realT>>
 Alias for a standard normal random variate.
template<typename realT>
using mx::math::expDistT = randomT<realT, std::mt19937_64, std::exponential_distribution<realT>>
 Alias for an exponential random variate.
template<typename realT>
using mx::math::lapDistT = randomT<realT, std::mt19937_64, laplace_distribution<realT>>
 Alias for a laplace random variate.
template<typename intT>
using mx::math::poissonDistT = randomT<intT, std::mt19937_64, std::poisson_distribution<intT>>
 Alias for a poisson random variate.
template<typename realT>
using mx::math::lognormDistT = randomT<realT, std::mt19937_64, std::lognormal_distribution<realT>>
 Alias for a log normal variate.

Typedef Documentation

◆ expDistT

template<typename realT>
using mx::math::expDistT = randomT<realT, std::mt19937_64, std::exponential_distribution<realT>>

Alias for an exponential random variate.

Definition at line 320 of file randomT.hpp.

◆ lapDistT

template<typename realT>
using mx::math::lapDistT = randomT<realT, std::mt19937_64, laplace_distribution<realT>>

Alias for a laplace random variate.

Definition at line 324 of file randomT.hpp.

◆ lognormDistT

template<typename realT>
using mx::math::lognormDistT = randomT<realT, std::mt19937_64, std::lognormal_distribution<realT>>

Alias for a log normal variate.

Definition at line 332 of file randomT.hpp.

◆ normDistT

template<typename realT>
using mx::math::normDistT = randomT<realT, std::mt19937_64, std::normal_distribution<realT>>

Alias for a standard normal random variate.

Definition at line 316 of file randomT.hpp.

◆ poissonDistT

template<typename intT>
using mx::math::poissonDistT = randomT<intT, std::mt19937_64, std::poisson_distribution<intT>>

Alias for a poisson random variate.

Definition at line 328 of file randomT.hpp.

◆ uniDistT

template<typename realT>
using mx::math::uniDistT = randomT<realT, std::mt19937_64, std::uniform_real_distribution<realT>>

Alias for a uniform random variate.

Definition at line 312 of file randomT.hpp.

Function Documentation

◆ randomSeed()

template<typename intT>
int mx::math::randomSeed ( intT & seedval)

Get a value to use as a random seed.

On Linux systems, uses /dev/urandom to populate the value with sizeof(intT) bytes. Otherwise, uses time(0) to get time since the epoch.

Returns
0 on success.
-1 on error.
Template Parameters
intTis the integer type of seeval.
Parameters
[out]seedvalwill be populated with the seed.

Definition at line 53 of file randomSeed.hpp.

References mx::errno2error_t(), mx::filererr, and mx::internal::mxlib_error_report().

Referenced by mx::math::randomT< realT, std::mt19937_64, std::normal_distribution< realT > >::seed().