#2823: error: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648

This commit is contained in:
Günter Obiltschnig 2021-11-05 14:58:40 +01:00
parent 8bfeb52018
commit a032f771af

View File

@ -149,13 +149,13 @@ inline bool Random::nextBool()
inline float Random::nextFloat()
{
return float(next()) / 0x7FFFFFFF;
return static_cast<float>(nextDouble());
}
inline double Random::nextDouble()
{
return double(next()) / 0x7FFFFFFF;
return static_cast<double>(next()) / static_cast<double>(0x7FFFFFFF);
}