summaryrefslogtreecommitdiff
path: root/include/System/Random.hpp
diff options
context:
space:
mode:
authorAetias <144526980+AetiasHax@users.noreply.github.com>2025-07-21 19:09:56 +0200
committerGitHub <noreply@github.com>2025-07-21 19:09:56 +0200
commitaee9c362bbeb9ae717f4b93cbbd5fa0dd9a71450 (patch)
tree76d68901c25694abd6e3b7f90821e36229accf32 /include/System/Random.hpp
parent32cc123547fef2ff4aa170ef27ee0a825957a859 (diff)
ActorRupee 90% (#124)
* Remove `force_data` macro * Use size_t in `operator new` * Bump objdiff to v3.0.0-beta.10 * Decompile functions using gRandom * ActorRupee 90% * Fix old gRandom.Next calls * Revert objdiff * Clean up
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;
}
};