32 #ifndef MCKL_RANDOM_SAMPLING_DISTRIBUTION_HPP 33 #define MCKL_RANDOM_SAMPLING_DISTRIBUTION_HPP 43 template <
typename IntType>
44 class SamplingDistribution
66 const param_type ¶m1,
const param_type ¶m2)
68 return param1.n_ == param2.n_ && param1.m_ == param2.m_;
72 const param_type ¶m1,
const param_type ¶m2)
74 return !(param1 == param2);
77 template <
typename CharT,
typename Traits>
79 std::basic_ostream<CharT, Traits> &os,
const param_type ¶m)
84 os << param.n_ <<
' ';
90 template <
typename CharT,
typename Traits>
92 std::basic_istream<CharT, Traits> &is, param_type ¶m)
99 is >> std::ws >> n >>
m;
102 if (n >= m && m > 0) {
106 is.setstate(std::ios_base::failbit);
141 template <
typename RNGType>
152 if ((n - t) * u >= m - s) {
167 return dist1.param_ == dist2.param_;
173 return !(dist1 == dist2);
176 template <
typename CharT,
typename Traits>
185 template <
typename CharT,
typename Traits>
189 is >> std::ws >> dist.param_;
202 #endif // MCKL_RANDOM_SAMPLING_DISTRIBUTION_HPP Standard uniform distribution on [0, 1)
Drawing a subset without replacement.
friend std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > &is, distribution_type &dist)
friend bool operator==(const param_type ¶m1, const param_type ¶m2)
RealType u01(UIntType u)
Convert uniform unsigned integers to floating points within [0, 1].
void max(result_type *r) const
void operator()(RNGType &rng, result_type *r) const
SamplingDistribution(result_type n=1, result_type m=1)
friend std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &os, const param_type ¶m)
SamplingDistribution< IntType > distribution_type
friend std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &os, const distribution_type &dist)
void min(result_type *r) const
friend bool operator!=(const distribution_type &dist1, const distribution_type &dist2)
param_type(result_type n=1, result_type m=1)
friend bool operator!=(const param_type ¶m1, const param_type ¶m2)
friend std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > &is, param_type ¶m)
#define MCKL_DEFINE_RANDOM_DISTRIBUTION_ASSERT_INT_TYPE(Name, MinBits)
friend bool operator==(const distribution_type &dist1, const distribution_type &dist2)