From de7aa40132ede800f8a389817e50c4ac41f9cf8d Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Thu, 23 Nov 2017 09:01:16 +0100 Subject: [PATCH] Be more pedantic with static_cast (now works also for std::complex). --- tests/tests.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/tests.h b/tests/tests.h index 80db3b4a65..84da785348 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -191,9 +191,10 @@ namespace Testing // Get a uniformly distributed random value between min and max template -T random_value(const T &min=0, const T &max=1) +T random_value(const T &min=static_cast(0), + const T &max=static_cast(1)) { - return min+(max-min)*(Testing::rand()/static_cast(RAND_MAX)); + return min+(max-min)*(static_cast(Testing::rand())/static_cast(RAND_MAX)); } -- 2.39.5