27 #ifndef mx_math_randomT_hpp
28 #define mx_math_randomT_hpp
60 template<
class typeT,
class _ranengT,
class _randistT>
class randomT
96 void seed(
typename ranengT::result_type seedval )
106 typename ranengT::result_type seedval;
135 template<
typename _RealType =
double>
138 static_assert(std::is_floating_point<_RealType>::value,
"template argument not a floating point type");
149 explicit param_type(_RealType __lambda = _RealType(1)) : _M_lambda(__lambda)
152 _RealType lambda()
const
159 return __p1._M_lambda == __p2._M_lambda;
187 return _M_param.lambda();
212 return std::numeric_limits<result_type>::min();
220 return std::numeric_limits<result_type>::max();
231 template<
typename _UniformRandomNumberGenerator> result_type operator()
232 (_UniformRandomNumberGenerator& __urng,
const param_type& __p)
236 result_type __aurng = 0.5 - std::generate_canonical<result_type, std::numeric_limits<result_type>::digits, _UniformRandomNumberGenerator>(__urng);
245 return 0. -__p.lambda()*sgnx*std::log(1.-2.*__aurng);
256 template<
typename _RealType>
272 return !(__d1 == __d2);
285 template<
typename _RealType,
typename _CharT,
typename _Traits> std::basic_ostream<_CharT, _Traits>&
286 operator<<(std::basic_ostream<_CharT, _Traits>&,
const laplace_distribution<_RealType>&);
298 template<
typename _RealType,
typename _CharT,
typename _Traits> std::basic_istream<_CharT, _Traits>&
309 template<
typename realT>
313 template<
typename realT>
318 template<
typename realT>
322 template<
typename realT>
326 template<
typename intT>
330 template<
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.
_randistT distribution
The random distribution.
randomT(bool doSeed=true)
Constructor.
void seed(typename ranengT::result_type seedval)
Set the seed of the random engine.
_ranengT ranengT
Typedef for the engine type.
ranengT engine
The random engine.
_randistT randistT
Typedef for the distribution type.
void seed()
Seed the random engine with a good value.
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.