AuroraRuntime/Include/Aurora/RNG/RandomDef.hpp
Reece Wilson efc02d24f7 [*] Refactor RandomDef: bSecure, ::SetQuickRng()
[*] Default initialize net protocols to zero (tcp)
[*] Warning under AuUInt8 &ByteBuffer::operator[](AuUInt idx)
2022-09-27 17:30:26 +01:00

61 lines
1.3 KiB
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: RandomDef.hpp
Date: 2022-2-6
Author: Reece
***/
#pragma once
namespace Aurora::RNG
{
struct RandomDef
{
AU_COPY_MOVE_DEF(RandomDef);
bool bSecure {};
AuOptional<AuUInt32> seed;
AuOptional<AuUInt64> seed64;
AuOptional<AuArray<AuUInt8, 64>> seedMassive;
inline auline void SetSeed(AuUInt32 seed)
{
Reset();
this->seed = seed;
this->bSecure = false;
}
inline auline void SetSeed64(AuUInt64 seed)
{
Reset();
this->seed64 = seed;
this->bSecure = false;
}
inline auline void SetMassiveSeed(const AuArray<AuUInt8, 64> &seed)
{
Reset();
this->seedMassive = seed;
this->bSecure = false;
}
inline auline void SetCSRNG()
{
Reset();
this->bSecure = true;
}
inline auline void SetQuickRng()
{
Reset();
}
inline auline void Reset()
{
this->bSecure = false;
this->seed.reset();
this->seed64.reset();
this->seedMassive.reset();
}
};
}