diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-03-18 20:34:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-03-18 20:41:06 +0300 |
commit | b5fead8f53a555b62c9de2dc23b0f2ce9a136e8e (patch) | |
tree | b4b3be6ca5dec68b68cabf83dd21626b70707c08 /src/particle | |
parent | 5b293feb5367ccabd3edf49783511c895807876b (diff) | |
download | mv-b5fead8f53a555b62c9de2dc23b0f2ce9a136e8e.tar.gz mv-b5fead8f53a555b62c9de2dc23b0f2ce9a136e8e.tar.bz2 mv-b5fead8f53a555b62c9de2dc23b0f2ce9a136e8e.tar.xz mv-b5fead8f53a555b62c9de2dc23b0f2ce9a136e8e.zip |
Add custom rand function implimentation, based on precreated random sequence.
Diffstat (limited to 'src/particle')
-rw-r--r-- | src/particle/particle.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp index 4bf01207c..eb2456306 100644 --- a/src/particle/particle.cpp +++ b/src/particle/particle.cpp @@ -42,6 +42,7 @@ #include "utils/delete2.h" #include "utils/dtor.h" #include "utils/mathutils.h" +#include "utils/mrand.h" #include "debug.h" @@ -161,11 +162,11 @@ void Particle::updateSelf() restrict2 if (mRandomness >= 10) // reduce useless calculations { const int rand2 = mRandomness * 2; - mVelocity.x += static_cast<float>(std::rand() % rand2 - mRandomness) + mVelocity.x += static_cast<float>(mrand() % rand2 - mRandomness) / 1000.0F; - mVelocity.y += static_cast<float>(std::rand() % rand2 - mRandomness) + mVelocity.y += static_cast<float>(mrand() % rand2 - mRandomness) / 1000.0F; - mVelocity.z += static_cast<float>(std::rand() % rand2 - mRandomness) + mVelocity.z += static_cast<float>(mrand() % rand2 - mRandomness) / 1000.0F; } |