Core/Random: Changed random functions returning doubles to return floats

Port From (https://github.com/TrinityCore/TrinityCore/commit/9894f6b802c974bb36acd7fbb0d083455a1f0f1b)
This commit is contained in:
hondacrx
2024-02-02 14:39:02 -05:00
parent c5538d6d40
commit a5bc0d0d9b
10 changed files with 24 additions and 24 deletions
+5 -5
View File
@@ -3389,12 +3389,12 @@ namespace Game.Entities
}
// angle to face `obj` to `this`
float angle = (float)RandomHelper.NextDouble() * (2 * MathFunctions.PI);
float new_dist = (float)RandomHelper.NextDouble() + (float)RandomHelper.NextDouble();
float angle = RandomHelper.NextSingle() * (2 * MathFunctions.PI);
float new_dist = RandomHelper.NextSingle() + RandomHelper.NextSingle();
new_dist = distance * (new_dist > 1 ? new_dist - 2 : new_dist);
rand_x = (float)(pos.posX + new_dist * Math.Cos(angle));
rand_y = (float)(pos.posY + new_dist * Math.Sin(angle));
rand_x = (pos.posX + new_dist * MathF.Cos(angle));
rand_y = (pos.posY + new_dist * MathF.Sin(angle));
rand_z = pos.posZ;
GridDefines.NormalizeMapCoord(ref rand_x);
@@ -3570,7 +3570,7 @@ namespace Game.Entities
public Position GetRandomNearPosition(float radius)
{
var pos = GetPosition();
MovePosition(pos, radius * (float)RandomHelper.NextDouble(), (float)RandomHelper.NextDouble() * MathFunctions.PI * 2);
MovePosition(pos, radius * RandomHelper.NextSingle(), RandomHelper.NextSingle() * MathFunctions.PI * 2);
return pos;
}
+1 -1
View File
@@ -3410,7 +3410,7 @@ namespace Game.Entities
discreteResistProbability[i] = Math.Max(0.5f - 2.5f * Math.Abs(0.1f * i - averageResist), 0.0f);
}
float roll = (float)RandomHelper.NextDouble();
float roll = RandomHelper.NextSingle();
float probabilitySum = 0.0f;
uint resistance = 0;