particle: explicitly cast RAND_MAX to float

This silences a warning in clang-11
This commit is contained in:
Sebastian Krzyszkowiak 2020-03-01 23:45:42 +01:00
parent b592a3382f
commit 4fe091d93c
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF

View file

@ -144,7 +144,7 @@ SYMBOL_EXPORT struct ParticleState SpawnParticleIn(float x, float y) {
} }
SYMBOL_EXPORT struct ParticleState SpawnParticleBetween(float x1, float y1, float x2, float y2) { SYMBOL_EXPORT struct ParticleState SpawnParticleBetween(float x1, float y1, float x2, float y2) {
float x = x1 + (x2 - x1) * rand() / RAND_MAX, y = y1 + (y2 - y1) * rand() / RAND_MAX; float x = x1 + (x2 - x1) * rand() / (float)RAND_MAX, y = y1 + (y2 - y1) * rand() / (float)RAND_MAX;
return SpawnParticleIn(x, y); return SpawnParticleIn(x, y);
} }