aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2007-10-20 10:02:09 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2007-10-20 10:02:09 +0000
commitb59d6a2bba815b2ffc5eea4de6749f5e24b16743 (patch)
tree18f59475740a4d094f4fdea2e4cefe8e897260b9
parent6f535271b7ddae27e177a1ba1cb091872aeea04e (diff)
downloadgcc-b59d6a2bba815b2ffc5eea4de6749f5e24b16743.zip
gcc-b59d6a2bba815b2ffc5eea4de6749f5e24b16743.tar.gz
gcc-b59d6a2bba815b2ffc5eea4de6749f5e24b16743.tar.bz2
random (uniform_int<>::_M_call(_UniformRandomNumberGenerator&, result_type, result_type, true_type)): Fix small thinko.
2007-10-20 Paolo Carlini <pcarlini@suse.de> * include/tr1_impl/random (uniform_int<>::_M_call(_UniformRandomNumberGenerator&, result_type, result_type, true_type)): Fix small thinko. From-SVN: r129506
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/include/tr1_impl/random3
2 files changed, 8 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index b4f58ac..c839f27 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+2007-10-20 Paolo Carlini <pcarlini@suse.de>
+
+ * include/tr1_impl/random
+ (uniform_int<>::_M_call(_UniformRandomNumberGenerator&, result_type,
+ result_type, true_type)): Fix small thinko.
+
2007-10-19 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/33815
diff --git a/libstdc++-v3/include/tr1_impl/random b/libstdc++-v3/include/tr1_impl/random
index f44b17f..7b9b951 100644
--- a/libstdc++-v3/include/tr1_impl/random
+++ b/libstdc++-v3/include/tr1_impl/random
@@ -1609,7 +1609,8 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
// is smaller than __max - __min.
typedef typename __gnu_cxx::__add_unsigned<typename
_UniformRandomNumberGenerator::result_type>::__type __utype;
- return result_type((__max - __min + 1.0L) * __utype(__urng())
+ return result_type((__max - __min + 1.0L)
+ * (__utype(__urng()) - __utype(__urng.min()))
/ (__utype(__urng.max())
- __utype(__urng.min()) + 1.0L)) + __min;
}