AuroraRuntime/Source/RNG/AuWELL.hpp

29 lines
711 B
C++

#pragma once
struct WELLRand
{
AuUInt32 state[16];
int index {};
AuFutexMutex lock;
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;
}
};
WELLRand WELL_SeedRand(AuUInt32 seed);
WELLRand WELL_SeedRandBig64(const AuArray<AuUInt8, 64> &seed);
WELLRand WELL_SeedRand64(AuUInt64 seed);
AuUInt32 WELL_NextLong(WELLRand* rand);
void WELL_NextBytes(WELLRand *rand, void *in, AuUInt32 length);