OpenBarnyard
Loading...
Searching...
No Matches
TRandom.h
Go to the documentation of this file.
1
#pragma once
2
/*
3
------------------------------------------------------------------------------
4
rand.c: By Bob Jenkins. My random number generator, ISAAC. Public Domain.
5
MODIFIED:
6
960327: Creation (addition of randinit, really)
7
970719: use context, not global variables, for internal state
8
980324: added main (ifdef'ed out), also rearranged randinit()
9
010626: Note that this is public domain
10
------------------------------------------------------------------------------
11
*/
12
// mix with source: https://github.com/jawnsy/Math-Random-ISAAC-XS/blob/master/src/rand.c
13
14
#define RANDSIZL ( 4 )
/* 8 for crypto, 4 for simulations (aka Toshi uses 4) */
15
#define RANDSIZ ( 1 << RANDSIZL )
16
17
#include "
Toshi/THPTimer.h
"
18
19
TOSHI_NAMESPACE_START
20
21
class
TRandom
22
{
23
public
:
24
TRandom
();
25
26
TINT
GetInt
();
27
TINT
GetInt
(
TUINT32
a_iLower,
TUINT32
a_iUpper );
28
TINT
GetInt
(
TUINT32
a_iUpper );
29
30
TFLOAT
GetFloat
();
31
TFLOAT
GetFloatMinMax
(
TFLOAT
a_fLower,
TFLOAT
a_fUpper );
32
TFLOAT
GetFloat2
();
33
34
TUINT32
RandRaw
();
35
36
void
SetSeed
(
TUINT
a_uiSeed );
37
TUINT32
GetSeed
()
const
{
return
m_uiSeed; }
38
39
private
:
40
void
Isaac();
41
void
RandInit();
42
43
private
:
44
TUINT32
m_uiSeed;
// 0x0
45
TUINT32
m_uiRndCnt;
// 0x4
46
TUINT32
m_pRandrsl[
RANDSIZ
];
//0x8
47
48
TUINT32
m_pRandmem[
RANDSIZ
];
// 0x48
49
50
TUINT32
m_uiRandA;
// 0x88
51
TUINT32
m_uiRandB;
// 0x8C
52
TUINT32
m_uiRandC;
// 0x90
53
};
54
55
TOSHI_NAMESPACE_END
RANDSIZ
#define RANDSIZ
Definition
TRandom.h:15
TOSHI_NAMESPACE_START
#define TOSHI_NAMESPACE_START
Definition
Defines.h:47
TOSHI_NAMESPACE_END
#define TOSHI_NAMESPACE_END
Definition
Defines.h:50
THPTimer.h
TUINT
unsigned int TUINT
Definition
Typedefs.h:8
TFLOAT
float TFLOAT
Definition
Typedefs.h:4
TUINT32
uint32_t TUINT32
Definition
Typedefs.h:13
TINT
int TINT
Definition
Typedefs.h:7
TRandom::GetFloat2
TFLOAT GetFloat2()
Definition
TRandom.cpp:194
TRandom::GetInt
TINT GetInt()
Definition
TRandom.cpp:178
TRandom::GetSeed
TUINT32 GetSeed() const
Definition
TRandom.h:37
TRandom::TRandom
TRandom()
Definition
TRandom.cpp:59
TRandom::SetSeed
void SetSeed(TUINT a_uiSeed)
Definition
TRandom.cpp:199
TRandom::GetFloat
TFLOAT GetFloat()
Definition
TRandom.cpp:183
TRandom::RandRaw
TUINT32 RandRaw()
Definition
TRandom.cpp:205
TRandom::GetFloatMinMax
TFLOAT GetFloatMinMax(TFLOAT a_fLower, TFLOAT a_fUpper)
Definition
TRandom.cpp:189
D:
_dev
OpenBarnyard
Source
Toshi
Source
Math
TRandom.h
Generated by
1.13.2