aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/tr1/random
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2006-06-19 16:03:07 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2006-06-19 16:03:07 +0000
commit3c618f8732814407a5c98146fa24761ba7dddd78 (patch)
treedfa086017c9dd38936ecf97ec423c0df48ff3287 /libstdc++-v3/include/tr1/random
parent7ed9c0015f129b4abf51c241f6dec346120088e1 (diff)
downloadgcc-3c618f8732814407a5c98146fa24761ba7dddd78.zip
gcc-3c618f8732814407a5c98146fa24761ba7dddd78.tar.gz
gcc-3c618f8732814407a5c98146fa24761ba7dddd78.tar.bz2
random (xor_combine<>::operator<<): Fix typo.
2006-06-19 Paolo Carlini <pcarlini@suse.de> * include/tr1/random (xor_combine<>::operator<<): Fix typo. * include/tr1/random (bernoulli_distribution::min(), bernoulli_distribution::max(), geometric_distribution<>::min(), geometric_distribution<>::max()): Remove. * include/tr1/random (geometric_distribution<>::operator()): Simplify formula. * include/tr1/random: Minor cosmetic changes. * testsuite/tr1/5_numerical_facilities/random/discard_block/ operators/equal.cc: New. * testsuite/tr1/5_numerical_facilities/random/discard_block/ operators/not_equal.cc: Likewise. * testsuite/tr1/5_numerical_facilities/random/discard_block/ operators/serialize.cc: Likewise. * testsuite/tr1/5_numerical_facilities/random/xor_combine/ operators/equal.cc: Likewise. * testsuite/tr1/5_numerical_facilities/random/xor_combine/ operators/not_equal.cc: Likewise. * testsuite/tr1/5_numerical_facilities/random/xor_combine/ operators/serialize.cc: Likewise. From-SVN: r114777
Diffstat (limited to 'libstdc++-v3/include/tr1/random')
-rw-r--r--libstdc++-v3/include/tr1/random47
1 files changed, 10 insertions, 37 deletions
diff --git a/libstdc++-v3/include/tr1/random b/libstdc++-v3/include/tr1/random
index 0f4ab01..69bda57 100644
--- a/libstdc++-v3/include/tr1/random
+++ b/libstdc++-v3/include/tr1/random
@@ -840,7 +840,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
/**
* Constructs a default %discard_block engine.
*
- * The underlying engine is default constrcuted as well.
+ * The underlying engine is default constructed as well.
*/
discard_block()
: _M_n(0) { }
@@ -851,8 +851,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* Copies an existing base class random number geenerator.
* @param rng An existing (base class) engine object.
*/
- explicit discard_block(const base_type& __rng)
- : _M_b(__rng) , _M_n(0) { }
+ explicit
+ discard_block(const base_type& __rng)
+ : _M_b(__rng), _M_n(0) { }
/**
* Seed constructs a %discard_block engine.
@@ -860,7 +861,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
* Constructs the underlying generator engine seeded with @p __s.
* @param __s A seed value for the base class engine.
*/
- explicit discard_block(unsigned long __s)
+ explicit
+ discard_block(unsigned long __s)
: _M_b(__s), _M_n(0) { }
/**
@@ -1135,7 +1137,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const xor_combine& __x)
- { return __os << __x.base1() << " " << __x.base1(); }
+ { return __os << __x.base1() << " " << __x.base2(); }
/**
* Extracts the current state of a %xor_combine random number
@@ -1344,7 +1346,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const uniform_int& __x)
- { return __os << __x._M_min << " " << __x._M_max; }
+ { return __os << __x.min() << " " << __x.max(); }
/**
* Extracts a %unform_int random number distribution
@@ -1400,20 +1402,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
{ return _M_p; }
/**
- * Gets the inclusive lower bound of the distribution range.
- */
- result_type
- min() const
- { return false; }
-
- /**
- * Gets the inclusive upper bound of the distribution range.
- */
- result_type
- max() const
- { return true; }
-
- /**
* Resets the distribution state.
*
* Does nothing for a bernoulli distribution.
@@ -1500,28 +1488,13 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
p() const
{ return _M_p; }
- /**
- * Gets the inclusive lower bound of the distribution range.
- */
- result_type
- min() const;
-
- /**
- * Gets the inclusive upper bound of the distribution range.
- */
- result_type
- max() const;
-
void
reset() { }
template<class _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng)
- {
- return result_type(std::floor(std::log(_RealType(1.0) - __urng())
- / _M_log_p)) + result_type(1);
- }
+ { return result_type(std::ceil(std::log(__urng()) / _M_log_p)); }
/**
* Inserts a %geometric_distribution random number distribution
@@ -1631,7 +1604,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const uniform_real& __x)
- { return __os << __x._M_min << " " << __x._M_max; }
+ { return __os << __x.min() << " " << __x.max(); }
/**
* Extracts a %unform_real random number distribution