summaryrefslogtreecommitdiffstats
path: root/src/core/General.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/General.h')
-rw-r--r--src/core/General.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/core/General.h b/src/core/General.h
index dde43c0f..7e06b96e 100644
--- a/src/core/General.h
+++ b/src/core/General.h
@@ -2,6 +2,8 @@
#include <ctype.h>
+// --MIAMI: file done
+
class CGeneral
{
public:
@@ -134,6 +136,18 @@ public:
return *str2 != '\0';
}
+ static bool SolveQuadratic(float a, float b, float c, float &root1, float &root2)
+ {
+ float discriminant = b * b - 4.f * a * c;
+ if (discriminant < 0.f)
+ return false;
+
+ float discriminantSqrt = Sqrt(discriminant);
+ root2 = (-b + discriminantSqrt) / (2.f * a);
+ root1 = (-b - discriminantSqrt) / (2.f * a);
+ return true;
+ }
+
// not too sure about all these...
static uint16 GetRandomNumber(void)
{ return myrand() & MYRAND_MAX; }
@@ -145,4 +159,6 @@ public:
static int32 GetRandomNumberInRange(int32 low, int32 high)
{ return low + (high - low)*(GetRandomNumber()/float(MYRAND_MAX + 1)); }
+ static void SetRandomSeed(int32 seed)
+ { mysrand(seed); }
};