random (uniform_int<>::_M_call(_UniformRandomNumberGenerator&, result_type, result_ty...
authorPaolo Carlini <pcarlini@suse.de>
Sat, 20 Oct 2007 10:02:09 +0000 (10:02 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sat, 20 Oct 2007 10:02:09 +0000 (10:02 +0000)
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

libstdc++-v3/ChangeLog
libstdc++-v3/include/tr1_impl/random

index b4f58acbc0991d081976c6386ee7cabcc9c8d9f0..c839f27efed7054a39a3cebae96886f349f41a7a 100644 (file)
@@ -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
index f44b17f97924d9c4cda59b895287e61c44ac02db..7b9b951f74a1c7c6a36cf8152b7e8cba69096e3f 100644 (file)
@@ -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;
        }