summaryrefslogtreecommitdiff
path: root/include/System/Random.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/System/Random.hpp')
-rw-r--r--include/System/Random.hpp6
1 files changed, 3 insertions, 3 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;
}
};