71 lines
1.5 KiB
C++
71 lines
1.5 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);
|
|
|
|
inline RandomDef(AuUInt32 seed)
|
|
{
|
|
this->SetSeed(seed);
|
|
}
|
|
|
|
inline RandomDef(AuUInt64 seed)
|
|
{
|
|
this->SetSeed64(seed);
|
|
}
|
|
|
|
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();
|
|
}
|
|
};
|
|
} |