mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Random Numbers

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. More...
 
template<typename realT >
using mx::math::uniDistT = randomT< realT, std::mt19937_64, std::uniform_real_distribution< realT > >
 Alias for a uniform random variate. More...
 
template<typename realT >
using mx::math::normDistT = randomT< realT, std::mt19937_64, std::normal_distribution< realT > >
 Alias for a standard normal random variate. More...
 
template<typename realT >
using mx::math::expDistT = randomT< realT, std::mt19937_64, std::exponential_distribution< realT > >
 Alias for an exponential random variate. More...
 
template<typename realT >
using mx::math::lapDistT = randomT< realT, std::mt19937_64, laplace_distribution< realT > >
 Alias for a laplace random variate. More...
 
template<typename intT >
using mx::math::poissonDistT = randomT< intT, std::mt19937_64, std::poisson_distribution< intT > >
 Alias for a poisson random variate. More...
 
template<typename realT >
using mx::math::lognormDistT = randomT< realT, std::mt19937_64, std::lognormal_distribution< realT > >
 Alias for a log normal variate. More...
 

Typedef Documentation

◆ expDistT

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

Alias for an exponential random variate.

Definition at line 319 of file randomT.hpp.

◆ lapDistT

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

Alias for a laplace random variate.

Definition at line 323 of file randomT.hpp.

◆ lognormDistT

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

Alias for a log normal variate.

Definition at line 331 of file randomT.hpp.

◆ normDistT

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

Alias for a standard normal random variate.

Definition at line 314 of file randomT.hpp.

◆ poissonDistT

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

Alias for a poisson random variate.

Definition at line 327 of file randomT.hpp.

◆ uniDistT

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

Alias for a uniform random variate.

Definition at line 310 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 57 of file randomSeed.hpp.

Referenced by mx::math::randomT< typeT, _ranengT, _randistT >::seed().