[Libreoffice-commits] core.git: comphelper/source

Tor Lillqvist tml at collabora.com
Tue Oct 7 00:51:46 PDT 2014


 comphelper/source/misc/random.cxx |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit d1fbbb04f9c12614a7b64e4c1eb92dc6a5ea3fc7
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Oct 7 10:32:52 2014 +0300

    I shouldn't be shy, just assert()
    
    Stephan dislikes "defensive programming" and I trust him.
    
    Change-Id: Ic4864de98a5155129179eb89873f3ffdc8921614

diff --git a/comphelper/source/misc/random.cxx b/comphelper/source/misc/random.cxx
index 9071765..bcdd8e6 100644
--- a/comphelper/source/misc/random.cxx
+++ b/comphelper/source/misc/random.cxx
@@ -80,9 +80,7 @@ size_t uniform_int_distribution(size_t a, size_t b)
 // uniform size_t [a,b) distribution
 double uniform_real_distribution(double a, double b)
 {
-    // Probably too rude to just assert(a < b), so instead...
-    if (a >= b)
-        return a;
+    assert(a < b);
     boost::random::uniform_real_distribution<double> dist(a, b);
     return dist(theRandomNumberGenerator::get().global_rng);
 }


More information about the Libreoffice-commits mailing list