summaryrefslogtreecommitdiff
path: root/src/particle
diff options
context:
space:
mode:
Diffstat (limited to 'src/particle')
-rw-r--r--src/particle/particle.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp
index 425be6c91..aeb79a1b1 100644
--- a/src/particle/particle.cpp
+++ b/src/particle/particle.cpp
@@ -160,12 +160,13 @@ void Particle::updateSelf() restrict2
if (mRandomness > 0)
{
- mVelocity.x += static_cast<float>((rand() % mRandomness - rand()
- % mRandomness)) / 1000.0F;
- mVelocity.y += static_cast<float>((rand() % mRandomness - rand()
- % mRandomness)) / 1000.0F;
- mVelocity.z += static_cast<float>((rand() % mRandomness - rand()
- % mRandomness)) / 1000.0F;
+ const int rand2 = mRandomness * 2;
+ mVelocity.x += static_cast<float>(rand() % rand2 - mRandomness)
+ / 1000.0F;
+ mVelocity.y += static_cast<float>(rand() % rand2 - mRandomness)
+ / 1000.0F;
+ mVelocity.z += static_cast<float>(rand() % rand2 - mRandomness)
+ / 1000.0F;
}
mVelocity.z -= mGravity;