From f9cb00d5b7c9b313c42df43fedd00ef4eb4acb85 Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Wed, 22 Nov 2017 16:40:29 +0100 Subject: [PATCH] Fixed Denis' comments. --- tests/bits/joa_1.cc | 2 +- tests/tests.h | 12 +----------- 2 files changed, 2 insertions(+), 12 deletions(-) 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 -- 2.39.5