diff --git a/src/engine/rand.cpp b/src/engine/rand.cpp index 676991358b..915719498c 100644 --- a/src/engine/rand.cpp +++ b/src/engine/rand.cpp @@ -73,18 +73,18 @@ int32_t Rand::Queue::Get( const std::function & randomFunc return 0; } - const uint32_t sum = std::accumulate( begin(), end(), static_cast( 0 ), []( const uint32_t total, const ValuePercent & vp ) { return total + vp.second; } ); + const uint32_t sum = std::accumulate( begin(), end(), static_cast( 0 ), []( const uint32_t total, const ValueWeight & vw ) { return total + vw.second; } ); assert( sum > 0 ); uint32_t rand = randomFunc( sum - 1 ); assert( rand < sum ); - for ( const ValuePercent & vp : *this ) { - if ( rand < vp.second ) { - return vp.first; + for ( const ValueWeight & vw : *this ) { + if ( rand < vw.second ) { + return vw.first; } - rand -= vp.second; + rand -= vw.second; } assert( 0 ); diff --git a/src/engine/rand.h b/src/engine/rand.h index b8a5d85b7c..0a391cc196 100644 --- a/src/engine/rand.h +++ b/src/engine/rand.h @@ -85,9 +85,9 @@ namespace Rand return vec[id]; } - using ValuePercent = std::pair; + using ValueWeight = std::pair; - class Queue : private std::vector + class Queue : private std::vector { public: explicit Queue( uint32_t size = 0 )