]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/include/bits/random.h
random.h (negative_binomial_distribution<>:: negative_binomial_distribution(_IntType...
[thirdparty/gcc.git] / libstdc++-v3 / include / bits / random.h
index 26cec8a885e4cf8124ed53e9a47ce0f73a4867a8..8b09a98c37bc89c17ccc949b56b8882db4feed6f 100644 (file)
@@ -3611,8 +3611,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        param_type(double __p = 0.5)
        : _M_p(__p)
        {
-         _GLIBCXX_DEBUG_ASSERT((_M_p > 0.0)
-                            && (_M_p < 1.0));
+         _GLIBCXX_DEBUG_ASSERT((_M_p > 0.0) && (_M_p < 1.0));
          _M_initialize();
        }
 
@@ -3782,7 +3781,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        explicit
        param_type(_IntType __k = 1, double __p = 0.5)
        : _M_k(__k), _M_p(__p)
-       { }
+       {
+         _GLIBCXX_DEBUG_ASSERT((_M_k > 0) && (_M_p > 0.0) && (_M_p <= 1.0));
+       }
 
        _IntType
        k() const
@@ -3803,12 +3804,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
       explicit
       negative_binomial_distribution(_IntType __k = 1, double __p = 0.5)
-      : _M_param(__k, __p), _M_gd(__k, __p / (1.0 - __p))
+      : _M_param(__k, __p), _M_gd(__k, 1.0)
       { }
 
       explicit
       negative_binomial_distribution(const param_type& __p)
-      : _M_param(__p), _M_gd(__p.k(), __p.p() / (1.0 - __p.p()))
+      : _M_param(__p), _M_gd(__p.k(), 1.0)
       { }
 
       /**