Core/Random: Changed random functions returning doubles to return floats

* They were all cast to float at use anyway
* Improves roll_chance_f performance (rand32() is now called internally by uniform_real_distribution once instead of twice)
This commit is contained in:
Shauren
2023-10-31 20:20:00 +01:00
parent a0fdac0ecc
commit 9894f6b802
22 changed files with 47 additions and 45 deletions

View File

@@ -72,15 +72,15 @@ uint32 rand32()
return GetRng()->RandomUInt32();
}
double rand_norm()
float rand_norm()
{
std::uniform_real_distribution<double> urd;
std::uniform_real_distribution<float> urd;
return urd(engine);
}
double rand_chance()
float rand_chance()
{
std::uniform_real_distribution<double> urd(0.0, 100.0);
std::uniform_real_distribution<float> urd(0.0f, 100.0f);
return urd(engine);
}