27#ifndef mx_math_randomT_hpp
28#define mx_math_randomT_hpp
57template <
class typeT,
class _ranengT,
class _randistT>
96 void seed(
typename ranengT::result_type seedval )
107 typename ranengT::result_type seedval;
132template <
typename _RealType =
double>
135 static_assert( std::is_floating_point<_RealType>::value,
"template argument not a floating point type" );
146 explicit param_type( _RealType __lambda = _RealType( 1 ) ) : _M_lambda( __lambda )
155 friend bool operator==(
const param_type &__p1,
const param_type &__p2 )
157 return __p1._M_lambda == __p2._M_lambda;
191 return _M_param.lambda();
206 void param(
const param_type &__param )
216 return std::numeric_limits<result_type>::min();
224 return std::numeric_limits<result_type>::max();
230 template <
typename _UniformRandomNumberGenerator>
236 template <
typename _UniformRandomNumberGenerator>
237 result_type
operator()( _UniformRandomNumberGenerator &__urng,
const param_type &__p )
242 std::numeric_limits<result_type>::digits,
243 _UniformRandomNumberGenerator>( __urng );
251 return 0. - __p.lambda() * sgnx * std::log( 1. - 2. * __aurng );
262template <
typename _RealType>
272template <
typename _RealType>
275 return !( __d1 == __d2 );
288template <
typename _RealType,
typename _CharT,
typename _Traits>
289std::basic_ostream<_CharT, _Traits> &operator<<( std::basic_ostream<_CharT, _Traits> &,
290 const laplace_distribution<_RealType> & );
302template <
typename _RealType,
typename _CharT,
typename _Traits>
303std::basic_istream<_CharT, _Traits> &
operator>>( std::basic_istream<_CharT, _Traits> &,
311template <
typename realT>
315template <
typename realT>
319template <
typename realT>
323template <
typename realT>
327template <
typename intT>
331template <
typename realT>
The Laplace (double exponential) continuous distribution for random numbers.
_RealType lambda() const
Returns the inverse scale parameter of the distribution.
void param(const param_type &__param)
Sets the parameter set of the distribution.
laplace_distribution(const result_type &__lambda=result_type(1))
Constructs a Laplace (double exponential) distribution with inverse scale parameter .
void reset()
Resets the distribution state.
result_type min() const
Returns the greatest lower bound value of the distribution.
param_type param() const
Returns the parameter set of the distribution.
result_type max() const
Returns the least upper bound value of the distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
A random number type, which functions like any other arithmetic type.
std::normal_distribution< realT > distribution
randomT(bool doSeed=true)
Constructor.
void seed(typename ranengT::result_type seedval)
Set the seed of the random engine.
std::normal_distribution< realT > randistT
void seed()
Seed the random engine with a good value.
randomT< realT, std::mt19937_64, laplace_distribution< realT > > lapDistT
Alias for a laplace random variate.
randomT< realT, std::mt19937_64, std::exponential_distribution< realT > > expDistT
Alias for an exponential random variate.
randomT< intT, std::mt19937_64, std::poisson_distribution< intT > > poissonDistT
Alias for a poisson random variate.
randomT< realT, std::mt19937_64, std::lognormal_distribution< realT > > lognormDistT
Alias for a log normal variate.
randomT< realT, std::mt19937_64, std::normal_distribution< realT > > normDistT
Alias for a standard normal random variate.
randomT< realT, std::mt19937_64, std::uniform_real_distribution< realT > > uniDistT
Alias for a uniform random variate.
int randomSeed(intT &seedval)
Get a value to use as a random seed.
Defines a random number seed generator.
bool operator!=(const laplace_distribution< _RealType > &__d1, const laplace_distribution< _RealType > &__d2)
Return true if two exponential distributions have different parameters.
std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &, laplace_distribution< _RealType > &)
Extracts a laplace_distribution random number distribution __x from the input stream __is.
bool operator==(const laplace_distribution< _RealType > &__d1, const laplace_distribution< _RealType > &__d2)
Return true if two exponential distributions have the same parameters.