Kaydet (Commit) d1fbbb04 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

I shouldn't be shy, just assert()

Stephan dislikes "defensive programming" and I trust him.

Change-Id: Ic4864de98a5155129179eb89873f3ffdc8921614
üst 1b226b02
...@@ -80,9 +80,7 @@ size_t uniform_int_distribution(size_t a, size_t b) ...@@ -80,9 +80,7 @@ size_t uniform_int_distribution(size_t a, size_t b)
// uniform size_t [a,b) distribution // uniform size_t [a,b) distribution
double uniform_real_distribution(double a, double b) double uniform_real_distribution(double a, double b)
{ {
// Probably too rude to just assert(a < b), so instead... assert(a < b);
if (a >= b)
return a;
boost::random::uniform_real_distribution<double> dist(a, b); boost::random::uniform_real_distribution<double> dist(a, b);
return dist(theRandomNumberGenerator::get().global_rng); return dist(theRandomNumberGenerator::get().global_rng);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment