mirror of
https://github.com/encounter/ph.git
synced 2026-03-30 11:34:37 -07:00
aee9c362bb
* 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
23 lines
481 B
C++
23 lines
481 B
C++
#pragma once
|
|
|
|
#include "global.h"
|
|
#include "types.h"
|
|
|
|
struct Random {
|
|
/* 00 */ u64 mRandomValue;
|
|
/* 08 */ u64 mFactor;
|
|
/* 10 */ u64 mAddend;
|
|
/* 18 */
|
|
|
|
/**
|
|
* Generate a random number from 0 (inclusive) to `max` (exclusive)
|
|
*/
|
|
inline u32 Next(u32 min, u32 max) {
|
|
mRandomValue = mAddend + mFactor * mRandomValue;
|
|
u64 result = (mRandomValue >> 32) * (max - min);
|
|
return (result >> 32) + min;
|
|
}
|
|
};
|
|
|
|
extern Random gRandom;
|