summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/particle.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/particle.cpp b/src/particle.cpp
index 61290884..40a51888 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -136,9 +136,10 @@ bool Particle::update()
if (mRandomness > 0)
{
- mVelocity.x += (rand()%mRandomness - rand()%mRandomness) / 1000.0f;
- mVelocity.y += (rand()%mRandomness - rand()%mRandomness) / 1000.0f;
- mVelocity.z += (rand()%mRandomness - rand()%mRandomness) / 1000.0f;
+ const int rand2 = mRandomness * 2;
+ mVelocity.x += (rand() % rand2 - mRandomness) / 1000.0f;
+ mVelocity.y += (rand() % rand2 - mRandomness) / 1000.0f;
+ mVelocity.z += (rand() % rand2 - mRandomness) / 1000.0f;
}
mVelocity.z -= mGravity;