From b5fead8f53a555b62c9de2dc23b0f2ce9a136e8e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 18 Mar 2016 20:34:04 +0300 Subject: Add custom rand function implimentation, based on precreated random sequence. --- src/particle/particle.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/particle') 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(std::rand() % rand2 - mRandomness) + mVelocity.x += static_cast(mrand() % rand2 - mRandomness) / 1000.0F; - mVelocity.y += static_cast(std::rand() % rand2 - mRandomness) + mVelocity.y += static_cast(mrand() % rand2 - mRandomness) / 1000.0F; - mVelocity.z += static_cast(std::rand() % rand2 - mRandomness) + mVelocity.z += static_cast(mrand() % rand2 - mRandomness) / 1000.0F; } -- cgit v1.2.3-70-g09d2