Fix get random value from baselibrary returning key instead of value.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
aeac49d892
commit
b286d1726d
|
@ -58,12 +58,12 @@ namespace CreatureLib::Library {
|
||||||
inline const T* GetRandomValue(Arbutils::Random rand = Arbutils::Random()) const {
|
inline const T* GetRandomValue(Arbutils::Random rand = Arbutils::Random()) const {
|
||||||
auto i = rand.Get(_values.Count());
|
auto i = rand.Get(_values.Count());
|
||||||
auto& map = _values.GetStdMap();
|
auto& map = _values.GetStdMap();
|
||||||
return std::next(std::begin(map), i)->first;
|
return std::next(std::begin(map), i)->second;
|
||||||
}
|
}
|
||||||
inline const T* GetRandomValue(Arbutils::Random* rand) const {
|
inline const T* GetRandomValue(Arbutils::Random* rand) const {
|
||||||
auto i = rand->Get(_values.Count());
|
auto i = rand->Get(_values.Count());
|
||||||
auto& map = _values.GetStdMap();
|
auto& map = _values.GetStdMap();
|
||||||
return std::next(std::begin(map), i)->first;
|
return std::next(std::begin(map), i)->second;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue