Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
random.h
Go to the documentation of this file.
1#ifndef RANDOM_H
2#define RANDOM_H
3
4#include "dolphin/types.h"
5
6namespace JMath {
7
14
16 u32 get(void) {
17 value = (value * 0x19660d) + 0x3c6ef35f;
18 return value;
19 }
20
21 u32 get_bit32(void) { return this->get(); }
22
24 return get_ufloat_1() * param_0;
25 }
26
27 // due to the float constant, having this function inlined adds that float to data,
28 // making it not match
29 float get_ufloat_1(void) {
30 // !@bug UB: in C++ it's not legal to read from an union member other
31 // than the last one that was written to.
32 union {
33 f32 f;
34 u32 s;
35 } out;
36 out.s = (this->get() >> 9) | 0x3f800000;
37 return out.f - 1;
38 }
39
40 void setSeed(u32 seed) { value = seed; }
41};
42} // namespace JMath
43
44#endif /* RANDOM_H */
T cLib_calcTimer(T *value)
Definition c_lib.h:74
s
Definition e_acos.c:94
Definition JMATrigonometric.cpp:78
Definition random.h:12
u32 get(void)
Definition random.h:16
s8 get_uint8(u8 param_0)
Definition random.h:23
float get_ufloat_1(void)
Definition random.h:29
void setSeed(u32 seed)
Definition random.h:40
u32 get_bit32(void)
Definition random.h:21
u32 value
Definition random.h:13
signed char s8
Definition types.h:4
unsigned long u32
Definition types.h:10
float f32
Definition types.h:22
unsigned char u8
Definition types.h:8