Skip to content

Commit

Permalink
Main: inline Math::UnitRandom as it is on the hot path for particle e…
Browse files Browse the repository at this point in the history
…mission
  • Loading branch information
paroj committed Jan 4, 2024
1 parent 33edefb commit e928eda
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
2 changes: 1 addition & 1 deletion OgreMain/include/OgreMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ namespace Ogre
@return
A random number in the range from [0,1].
*/
static float UnitRandom();
static float UnitRandom() { return mRandProvider ? mRandProvider->getRandomUnit() : rand() / float(RAND_MAX); }

/** Generate a random number within the range provided.
@param fLow
Expand Down
7 changes: 0 additions & 7 deletions OgreMain/src/OgreMath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,6 @@ namespace Ogre
return Radian(-HALF_PI);
}
}
//-----------------------------------------------------------------------
float Math::UnitRandom ()
{
if (mRandProvider)
return mRandProvider->getRandomUnit();
else return rand() / float(RAND_MAX);
}

//-----------------------------------------------------------------------
void Math::SetRandomValueProvider(RandomValueProvider* provider)
Expand Down

0 comments on commit e928eda

Please sign in to comment.