Core/Random: Changed random functions returning doubles to return floats
* They were all cast to float at use anyway * Improves roll_chance_f performance (rand32() is now called internally by uniform_real_distribution once instead of twice)
This commit is contained in:
1 parent
56dc3bddd5
commit
7d57ef7299
13 files changed
+26
-26
No files matched your search
@@ -1549,8 +1549,8 @@ void WorldObject::GetRandomPoint(const Position &pos, float distance, float &ran
|
||||
}
|
||||
|
||||
// angle to face `obj` to `this`
|
||||
float angle = (float)rand_norm()*static_cast<float>(2*M_PI);
|
||||
float new_dist = (float)rand_norm() + (float)rand_norm();
|
||||
float angle = rand_norm() * static_cast<float>(2 * M_PI);
|
||||
float new_dist = rand_norm() + rand_norm();
|
||||
new_dist = distance * (new_dist > 1 ? new_dist - 2 : new_dist);
|
||||
|
||||
rand_x = pos.m_positionX + new_dist * std::cos(angle);
|
||||
@@ -3369,7 +3369,7 @@ Position WorldObject::GetFirstCollisionPosition(float dist, float angle)
|
||||
Position WorldObject::GetRandomNearPosition(float radius)
|
||||
{
|
||||
Position pos = GetPosition();
|
||||
MovePosition(pos, radius * (float)rand_norm(), (float)rand_norm() * static_cast<float>(2 * M_PI));
|
||||
MovePosition(pos, radius * rand_norm(), rand_norm() * static_cast<float>(2 * M_PI));
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user