From: Luca Heltai Date: Wed, 22 Nov 2017 15:40:29 +0000 (+0100) Subject: Fixed Denis' comments. X-Git-Tag: v9.0.0-rc1~739^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9cb00d5b7c9b313c42df43fedd00ef4eb4acb85;p=dealii.git Fixed Denis' comments. --- diff --git a/tests/bits/joa_1.cc b/tests/bits/joa_1.cc index 52d17ea024..a7deae98e9 100644 --- a/tests/bits/joa_1.cc +++ b/tests/bits/joa_1.cc @@ -1068,7 +1068,7 @@ void LaplaceProblem::run () // points inside a radius of 0.9) for (int i=0; i<1000; i++) { - double r = sqrt(random_value(.9)); + double r = sqrt(.9*random_value()); double phi = 2*3.14*(1.0*Testing::rand()/RAND_MAX); double x = r*cos(phi); double y = r*sin(phi); diff --git a/tests/tests.h b/tests/tests.h index 2301fe6ab1..80db3b4a65 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -191,23 +191,13 @@ namespace Testing // Get a uniformly distributed random value between min and max template -T random_value(const T &min, const T &max) +T random_value(const T &min=0, const T &max=1) { return min+(max-min)*(Testing::rand()/static_cast(RAND_MAX)); } -// Same as above, but allows one to leave 0 as a default minimum value, -// and specify only the maximum -template -T random_value(const T &max=1) -{ - return random_value(static_cast(0), max); -} - - - // Construct a uniformly distributed random point, with each coordinate // between min and max template