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

@@ -174,16 +174,16 @@ bool Weather::ReGenerate()
}
else if (u < 90)
{
m_intensity = (float)rand_norm() * 0.3333f;
m_intensity = rand_norm() * 0.3333f;
}
else
{
// Severe change, but how severe?
rnd = urand(0, 99);
if (rnd < 50)
m_intensity = (float)rand_norm() * 0.3333f + 0.3334f;
m_intensity = rand_norm() * 0.3333f + 0.3334f;
else
m_intensity = (float)rand_norm() * 0.3333f + 0.6667f;
m_intensity = rand_norm() * 0.3333f + 0.6667f;
}
// return true only in case weather changes