summaryrefslogtreecommitdiff
path: root/include/System
diff options
context:
space:
mode:
Diffstat (limited to 'include/System')
-rw-r--r--include/System/Random.hpp6
-rw-r--r--include/System/SysNew.hpp6
2 files changed, 7 insertions, 5 deletions
diff --git a/include/System/Random.hpp b/include/System/Random.hpp
index cc1f2a12..02bed0bd 100644
--- a/include/System/Random.hpp
+++ b/include/System/Random.hpp
@@ -12,10 +12,10 @@ struct Random {
/**
* Generate a random number from 0 (inclusive) to `max` (exclusive)
*/
- inline u32 Next(u32 max) {
+ inline u32 Next(u32 min, u32 max) {
mRandomValue = mAddend + mFactor * mRandomValue;
- u64 result = (mRandomValue >> 32) * max;
- return result >> 32;
+ u64 result = (mRandomValue >> 32) * (max - min);
+ return (result >> 32) + min;
}
};
diff --git a/include/System/SysNew.hpp b/include/System/SysNew.hpp
index 5b3089ed..e488166b 100644
--- a/include/System/SysNew.hpp
+++ b/include/System/SysNew.hpp
@@ -3,6 +3,8 @@
#include "global.h"
#include "types.h"
+#include <stddef.h>
+
struct UnkStruct_0202e894 {
/* 00 */ u32 mId;
/* 04 */ u32 *mUnk_04;
@@ -19,8 +21,8 @@ extern u32 *data_027e0ce0[];
class SysObject {
public:
- static void *operator new(unsigned long length, u32 *id, u32 idLength);
- static void *operator new[](unsigned long length, u32 *id, u32 idLength);
+ static void *operator new(size_t length, u32 *id, u32 idLength);
+ static void *operator new[](size_t length, u32 *id, u32 idLength);
static void operator delete(void *ptr);
static void operator delete[](void *ptr);
};