mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-29 15:23:02 +05:00
fix rand() misuse
This commit is contained in:
parent
2e82d001e1
commit
cffabce8ab
3 changed files with 5 additions and 4 deletions
|
@ -786,10 +786,10 @@ int NewFrameRender(int nEvent, void* pParam)
|
|||
#include <ctime>
|
||||
#include <random>
|
||||
|
||||
int Int32Rand()
|
||||
static std::ranlux48 generator (time(nullptr));
|
||||
int32_t Int32Rand()
|
||||
{
|
||||
static std::ranlux48 generator (time(nullptr));
|
||||
return generator() & 0x7FFFFFFF;
|
||||
return generator() & INT32_MAX;
|
||||
}
|
||||
|
||||
void (*FlushSpriteBuffer)() = AddressByVersion<void(*)()>(0x70CF20, 0x70D750, 0x7591E0, 0x753AE0, 0x753A00);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
extern void (*GTAdelete)(void* data);
|
||||
extern const char* (*GetFrameNodeName)(RwFrame*);
|
||||
extern RpHAnimHierarchy* (*GetAnimHierarchyFromSkinClump)(RpClump*);
|
||||
int32_t Int32Rand();
|
||||
|
||||
extern unsigned char& nGameClockDays;
|
||||
extern unsigned char& nGameClockMonths;
|
||||
|
|
|
@ -19,7 +19,7 @@ WRAPPER bool CVehicle::IsLawEnforcementVehicle() { VARJMP(varIsLawEnforcementVeh
|
|||
|
||||
static int32_t random(int32_t from, int32_t to)
|
||||
{
|
||||
return from + ( rand() % (to-from) );
|
||||
return from + ( Int32Rand() % (to-from) );
|
||||
}
|
||||
|
||||
static RwObject* GetCurrentAtomicObjectCB(RwObject* pObject, void* data)
|
||||
|
|
Loading…
Reference in a new issue