Skip to content
Snippets Groups Projects
Commit 76062f65 authored by Dominik Thoennes's avatar Dominik Thoennes
Browse files

Merge branch 'kohl/rename-random-scalar-typename' into 'master'

Renamed template parameter name.

See merge request !286
parents b4f3207e 9f5e94a4
No related merge requests found
...@@ -158,15 +158,15 @@ private: ...@@ -158,15 +158,15 @@ private:
* \brief Returns a random floating point number of type REAL in the range [min,max) (max excluded!) * \brief Returns a random floating point number of type REAL in the range [min,max) (max excluded!)
*/ */
//********************************************************************************************************************** //**********************************************************************************************************************
template< typename REAL = real_t > template< typename REAL_TYPE = real_t >
REAL realRandom( const REAL min = REAL(0), const REAL max = REAL(1), std::mt19937 & generator = internal::getGenerator() ) REAL_TYPE realRandom( const REAL_TYPE min = REAL_TYPE(0), const REAL_TYPE max = REAL_TYPE(1), std::mt19937 & generator = internal::getGenerator() )
{ {
static_assert( std::numeric_limits<REAL>::is_specialized && !std::numeric_limits<REAL>::is_integer, "Floating point type required/expected!" ); static_assert( std::numeric_limits<REAL_TYPE>::is_specialized && !std::numeric_limits<REAL_TYPE>::is_integer, "Floating point type required/expected!" );
WALBERLA_ASSERT_LESS( min, max ); WALBERLA_ASSERT_LESS( min, max );
std::uniform_real_distribution< REAL > distribution( min, max ); std::uniform_real_distribution< REAL_TYPE > distribution( min, max );
REAL value; REAL_TYPE value;
#ifdef _OPENMP #ifdef _OPENMP
#pragma omp critical (Random_random) #pragma omp critical (Random_random)
#endif #endif
...@@ -177,12 +177,12 @@ REAL realRandom( const REAL min = REAL(0), const REAL max = REAL(1), std::mt1993 ...@@ -177,12 +177,12 @@ REAL realRandom( const REAL min = REAL(0), const REAL max = REAL(1), std::mt1993
template< typename REAL > template< typename REAL_TYPE >
class RealRandom class RealRandom
{ {
public: public:
RealRandom( const std::mt19937::result_type & seed = std::mt19937::result_type() ) { generator_.seed( seed ); } RealRandom( const std::mt19937::result_type & seed = std::mt19937::result_type() ) { generator_.seed( seed ); }
REAL operator()( const REAL min = REAL(0), const REAL max = REAL(1) ) REAL_TYPE operator()( const REAL_TYPE min = REAL_TYPE(0), const REAL_TYPE max = REAL_TYPE(1) )
{ {
return realRandom( min, max, generator_ ); return realRandom( min, max, generator_ );
} }
......
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