mirror of
https://github.com/zeldaret/st
synced 2026-05-23 15:01:41 -04:00
e80f625b50
* delink ActorRupee and match few functions * add missing functions, mangle names and match func_ov031_020e9d54 * random stuff (literally) * decomp more of ActorRupee * rng stuff (thanks to aetias) * decomp more of ActorRupee (36%) * sync symbols * format * random: fixed wrong function call in configure.py * decomp more of ActorRupee (51%) * add actor ids and move them to their own header + small docs on actor class * format * improvements and small progress * progress * progress * sync eur with jp * fix build issues * missed a file
28 lines
596 B
C++
28 lines
596 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)
|
|
*/
|
|
u32 Next(u64 min, u64 max) {
|
|
mRandomValue = mAddend + mFactor * mRandomValue;
|
|
u64 result;
|
|
if ((max - min) == 0x100000000) {
|
|
result = mRandomValue;
|
|
} else {
|
|
result = (mRandomValue >> 32) * (max - min);
|
|
}
|
|
return (result >> 32) + min;
|
|
}
|
|
};
|
|
|
|
extern Random gRandom;
|