Files
dusklight/libs/JSystem/include/JSystem/JParticle/JPARandom.h
T
Luke Street 4df8ccc871 Reorganize library code into libs/ (#3119)
* Reorganize files into libs/{dolphin,JSystem,PowerPC_EABI_Support,revolution,TRK_MINNOW_DOLPHIN}

* Update configure.py and project.py for new libs structure

* Refactor `#include <dolphin/x.h>` -> `<x.h>`

* Remove `__REVOLUTION_SDK__` forwards from dolphin

* Fix dolphin/ references in revolution

* Wrap `#include <dolphin.h>` in `!__REVOLUTION_SDK__`

* Always build TRK against dolphin headers

* Resolve revolution SDK header resolution issues
2026-03-01 14:35:36 -08:00

44 lines
772 B
C++

#ifndef JPARANDOM_H
#define JPARANDOM_H
#include <types.h>
/**
* @ingroup jsystem-jparticle
*
*/
struct JPARandom {
public:
JPARandom() { mSeed = 0; }
JPARandom(u32 seed) { mSeed = seed; }
~JPARandom() {}
void set_seed(u32 seed) { mSeed = seed; }
u32 get_rndm_u() { return mSeed = mSeed * 0x19660du + 0x3c6ef35fu; }
f32 get_rndm_f() {
union {
u32 u;
f32 f;
} a;
a.u = ((get_rndm_u() >> 9) | 0x3f800000);
return a.f - 1.0f;
}
f32 get_rndm_zp() {
f32 f = get_rndm_f();
return (f + f) - 1.0f;
}
f32 get_rndm_zh() {
return get_rndm_f() - 0.5f;
}
s16 get_rndm_ss() { return (s16)(get_rndm_u() >> 16); }
public:
u32 mSeed;
};
#endif