From f79c39a13baf7a7af9baa47228afb98511c37560 Mon Sep 17 00:00:00 2001 From: Christian Godenschwager <christian.godenschwager@fau.de> Date: Mon, 29 Jan 2018 17:56:24 +0100 Subject: [PATCH] Work around for visual studio compiler bug --- src/core/math/Random.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/core/math/Random.h b/src/core/math/Random.h index 517c4d4be..dd4a4bff7 100644 --- a/src/core/math/Random.h +++ b/src/core/math/Random.h @@ -49,8 +49,25 @@ void seedRandomGenerator( const std::mt19937::result_type & seed ); // std::mt19 */ //********************************************************************************************************************** template< typename INT > -INT intRandom( const INT min = std::numeric_limits<INT>::min(), const INT max = std::numeric_limits<INT>::max(), - std::mt19937 & generator = internal::getGenerator() ) +INT intRandom() +{ + return intRandom( std::numeric_limits<INT>::min(), std::numeric_limits<INT>::max() ); +} + +template< typename INT > +INT intRandom( const INT min ) +{ + return intRandom( min, std::numeric_limits<INT>::max(), internal::getGenerator() ); +} + +template< typename INT > +INT intRandom( const INT min, const INT max ) +{ + return intRandom( min, max, internal::getGenerator() ); +} + +template< typename INT > +INT intRandom( const INT min, const INT max, std::mt19937 & generator ) { static_assert_int_t< INT >(); static_assert(sizeof(INT) > sizeof(char), "cannot use char"); -- GitLab