summaryrefslogtreecommitdiffstats
path: root/src/core/Range2D.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/Range2D.cpp')
-rw-r--r--src/core/Range2D.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core/Range2D.cpp b/src/core/Range2D.cpp
index daa36d6a..33eafd0e 100644
--- a/src/core/Range2D.cpp
+++ b/src/core/Range2D.cpp
@@ -18,5 +18,11 @@ CRange2D::DebugShowRange(float, int)
CVector2D
CRange2D::GetRandomPointInRange()
{
- return CVector2D(CGeneral::GetRandomNumberInRange(min.x, max.x), CGeneral::GetRandomNumberInRange(min.y, max.y));
+ int distX = Abs(max.x - min.x);
+ int distY = Abs(max.y - min.y);
+
+ float outX = CGeneral::GetRandomNumber() % distX + min.x;
+ float outY = CGeneral::GetRandomNumber() % distY + min.y;
+
+ return CVector2D(outX, outY);
}