AuroraRuntime/Source/RNG/AuWELL.hpp

29 lines
711 B
C++
Raw Normal View History

2021-09-06 10:58:08 +00:00
#pragma once
struct WELLRand
{
AuUInt32 state[16];
int index {};
AuFutexMutex lock;
2023-11-17 08:19:26 +00:00
inline WELLRand() = default;
inline WELLRand(WELLRand &&rand)
{
AuMemcpy(this->state, rand.state, sizeof(this->state));
this->index = rand.index;
}
inline WELLRand &operator =(WELLRand &&rand)
{
AuMemcpy(this->state, rand.state, sizeof(this->state));
this->index = rand.index;
return *this;
}
2021-09-06 10:58:08 +00:00
};
2023-11-17 08:19:26 +00:00
WELLRand WELL_SeedRand(AuUInt32 seed);
WELLRand WELL_SeedRandBig64(const AuArray<AuUInt8, 64> &seed);
WELLRand WELL_SeedRand64(AuUInt64 seed);
2021-09-06 10:58:08 +00:00
AuUInt32 WELL_NextLong(WELLRand* rand);
void WELL_NextBytes(WELLRand *rand, void *in, AuUInt32 length);