result_type
operator()();
+ /**
+ * Compares two % mersenne_twister random number generator objects of
+ * the same type for equality.
+ *
+ * @param __lhs A % mersenne_twister random number generator object.
+ * @param __rhs Another % mersenne_twister random number generator
+ * object.
+ *
+ * @returns true if the two objects are equal, false otherwise.
+ */
+ friend bool
+ operator==(const mersenne_twister& __lhs,
+ const mersenne_twister& __rhs)
+ { return std::equal(__lhs._M_x, __lhs._M_x + state_size, __rhs._M_x); }
+
+ /**
+ * Compares two % mersenne_twister random number generator objects of
+ * the same type for inequality.
+ *
+ * @param __lhs A % mersenne_twister random number generator object.
+ * @param __rhs Another % mersenne_twister random number generator
+ * object.
+ *
+ * @returns true if the two objects are not equal, false otherwise.
+ */
+ friend bool
+ operator!=(const mersenne_twister& __lhs,
+ const mersenne_twister& __rhs)
+ { return !(__lhs == __rhs); }
+
+ /**
+ * Inserts the current state of a % mersenne_twister random number
+ * generator engine @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A % mersenne_twister random number generator engine.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<typename _CharT, typename _Traits>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os,
+ const mersenne_twister& __x)
+ {
+ std::copy(__x._M_x, __x._M_x + state_size,
+ std::ostream_iterator<_UIntType>(__os, " "));
+ return __os;
+ }
+
+ /**
+ * Extracts the current state of a % mersenne_twister random number
+ * generator engine @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A % mersenne_twister random number generator engine.
+ *
+ * @returns The input stream with the state of @p __x extracted or in
+ * an error state.
+ */
+ template<typename _CharT, typename _Traits>
+ friend basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is,
+ mersenne_twister& __x)
+ {
+ for (int __i = 0; __i < state_size; ++__i)
+ __is >> __x._M_x[__i];
+ return __is;
+ }
+
private:
template<class _Gen>
void
friend bool
operator==(const subtract_with_carry& __lhs,
const subtract_with_carry& __rhs)
- {
- return ((__lhs._M_x[0] == __rhs._M_x[0])
- && (__lhs._M_x[__r - 1] == __rhs._M_x[__r - 1]));
- }
+ { return std::equal(__lhs._M_x, __lhs._M_x + long_lag, __rhs._M_x); }
/**
* Compares two % subtract_with_carry random number generator objects of
/**
* Inserts the current state of a % subtract_with_carry random number
- * genator engine @p x into the output stream @p __os.
+ * generator engine @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A % subtract_with_carry random number generator engine.
*
- * @returns The output stream with the state of @p x inserted or in an
- * error state.
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
*/
template<typename _CharT, typename _Traits>
friend basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const subtract_with_carry& __x)
{
- std::copy(__x._M_x, __x._M_x + __r,
+ std::copy(__x._M_x, __x._M_x + long_lag,
std::ostream_iterator<_IntType>(__os, " "));
return __os << __x._M_carry;
}
/**
* Extracts the current state of a % subtract_with_carry random number
- * gerator engine @p x from the input stream @p __is.
+ * generator engine @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A % subtract_with_carry random number generator engine.
*
- * @returns The input stream with the state of @p x extracted or in an
- * error state.
+ * @returns The input stream with the state of @p __x extracted or in
+ * an error state.
*/
template<typename _CharT, typename _Traits>
friend basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
subtract_with_carry& __x)
{
- for (int __i = 0; __i < __r; ++__i)
+ for (int __i = 0; __i < long_lag; ++__i)
__is >> __x._M_x[__i];
__is >> __x._M_carry;
return __is;
*/
friend bool
operator==(const discard_block& __lhs, const discard_block& __rhs)
- {
- return ((__lhs._M_b == __rhs._M_b)
- && (__lhs._M_n == __rhs._M_n));
- }
+ { return (__lhs._M_b == __rhs._M_b) && (__lhs._M_n == __rhs._M_n); }
/**
* Compares two %discard_block random number generator objects of
/**
* Inserts the current state of a %discard_block random number
- * genator engine @p x into the output stream @p __os.
+ * generator engine @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %discard_block random number generator engine.
*
- * @returns The output stream with the state of @p x inserted or in an
- * error state.
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
*/
template<typename _CharT, typename _Traits>
friend basic_ostream<_CharT, _Traits>&
/**
* Extracts the current state of a % subtract_with_carry random number
- * gerator engine @p x from the input stream @p __is.
+ * generator engine @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %discard_block random number generator engine.
*
- * @returns The input stream with the state of @p x extracted or in an
- * error state.
+ * @returns The input stream with the state of @p __x extracted or in
+ * an error state.
*/
template<typename _CharT, typename _Traits>
friend basic_istream<_CharT, _Traits>&
operator==(const xor_combine& __lhs, const xor_combine& __rhs)
{
return (__lhs.base1() == __rhs.base1())
- && (__lhs.base2() == __rhs.base2());
+ && (__lhs.base2() == __rhs.base2());
}
/**
/**
* Inserts the current state of a %xor_combine random number
- * genator engine @p x into the output stream @p __os.
+ * generator engine @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %xor_combine random number generator engine.
*
- * @returns The output stream with the state of @p x inserted or in an
- * error state.
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
*/
template<typename _CharT, typename _Traits>
friend basic_ostream<_CharT, _Traits>&
/**
* Extracts the current state of a %xor_combine random number
- * gerator engine @p x from the input stream @p __is.
+ * generator engine @p __x from the input stream @p __is.
*
* @param __is An input stream.
* @param __x A %xor_combine random number generator engine.
*
- * @returns The input stream with the state of @p x extracted or in an
- * error state.
+ * @returns The input stream with the state of @p __x extracted or in
+ * an error state.
*/
template<typename _CharT, typename _Traits>
friend basic_istream<_CharT, _Traits>&
{ return __urng() % __n; }
/**
- * Inserts a %uniform_int random number distribution @p x into the
+ * Inserts a %uniform_int random number distribution @p __x into the
* output stream @p os.
*
* @param __os An output stream.
* @param __x A %uniform_int random number distribution.
*
- * @returns The output stream with the state of @p x inserted or in an
- * error state.
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
*/
template<typename _CharT, typename _Traits>
friend basic_ostream<_CharT, _Traits>&
/**
* Extracts a %unform_int random number distribution
- * @p u from the input stream @p __is.
+ * @p __u from the input stream @p __is.
*
* @param __is An input stream.
* @param __u A %uniform_int random number generator engine.
*
- * @returns The input stream with @p u extracted or in an error state.
+ * @returns The input stream with @p __u extracted or in an error state.
*/
template<typename _CharT, typename _Traits>
friend basic_istream<_CharT, _Traits>&
/**
* Inserts a %bernoulli_distribution random number distribution
- * @p x into the output stream @p __os.
+ * @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %bernoulli_distribution random number distribution.
*
- * @returns The output stream with the state of @p x inserted or in an
- * error state.
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
*/
template<typename _CharT, typename _Traits>
friend basic_ostream<_CharT, _Traits>&
/**
* Extracts a %bernoulli_distribution random number distribution
- * @p u from the input stream @p __is.
+ * @p __u from the input stream @p __is.
*
* @param __is An input stream.
* @param __u A %bernoulli_distribution random number generator engine.
*
- * @returns The input stream with @p u extracted or in an error state.
+ * @returns The input stream with @p __u extracted or in an error state.
*/
template<typename _CharT, typename _Traits>
friend basic_istream<_CharT, _Traits>&
/**
* Inserts a %geometric_distribution random number distribution
- * @p x into the output stream @p __os.
+ * @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %geometric_distribution random number distribution.
*
- * @returns The output stream with the state of @p x inserted or in an
- * error state.
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
*/
template<typename _CharT, typename _Traits>
friend basic_ostream<_CharT, _Traits>&
/**
* Extracts a %geometric_distribution random number distribution
- * @p u from the input stream @p __is.
+ * @p __u from the input stream @p __is.
*
* @param __is An input stream.
* @param __u A %geometric_distribution random number generator engine.
*
- * @returns The input stream with @p u extracted or in an error state.
+ * @returns The input stream with @p __u extracted or in an error state.
*/
template<typename _CharT, typename _Traits>
friend basic_istream<_CharT, _Traits>&
{ return (__urng() * (max() - min())) + min(); }
/**
- * Inserts a %uniform_real random number distribution @p x into the
+ * Inserts a %uniform_real random number distribution @p __x into the
* output stream @p __os.
*
* @param __os An output stream.
* @param __x A %uniform_real random number distribution.
*
- * @returns The output stream with the state of @p x inserted or in an
- * error state.
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
*/
template<typename _CharT, typename _Traits>
friend basic_ostream<_CharT, _Traits>&
/**
* Extracts a %unform_real random number distribution
- * @p u from the input stream @p __is.
+ * @p __u from the input stream @p __is.
*
* @param __is An input stream.
* @param __u A %uniform_real random number generator engine.
*
- * @returns The input stream with @p u extracted or in an error state.
+ * @returns The input stream with @p __u extracted or in an error state.
*/
template<typename _CharT, typename _Traits>
friend basic_istream<_CharT, _Traits>&
/**
* Inserts a %exponential_distribution random number distribution
- * @p x into the output stream @p __os.
+ * @p __x into the output stream @p __os.
*
* @param __os An output stream.
* @param __x A %exponential_distribution random number distribution.
*
- * @returns The output stream with the state of @p x inserted or in an
- * error state.
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
*/
template<typename _CharT, typename _Traits>
friend basic_ostream<_CharT, _Traits>&
/**
* Extracts a %exponential_distribution random number distribution
- * @p u from the input stream @p __is.
+ * @p __u from the input stream @p __is.
*
* @param __is An input stream.
* @param __u A %exponential_distribution random number generator engine.
*
- * @returns The input stream with @p u extracted or in an error state.
+ * @returns The input stream with @p __u extracted or in an error state.
*/
template<typename _CharT, typename _Traits>
friend basic_istream<_CharT, _Traits>&