55 lines
1.2 KiB
C++
55 lines
1.2 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 secure;
|
|
AuOptional<AuUInt32> seed;
|
|
AuOptional<AuUInt64> seed64;
|
|
AuOptional<AuArray<AuUInt8, 64>> seedMassive;
|
|
|
|
inline auline void SetSeed(AuUInt32 seed)
|
|
{
|
|
Reset();
|
|
this->seed = seed;
|
|
this->secure = false;
|
|
}
|
|
|
|
inline auline void SetSeed64(AuUInt64 seed)
|
|
{
|
|
Reset();
|
|
this->seed64 = seed;
|
|
this->secure = false;
|
|
}
|
|
|
|
inline auline void SetMassiveSeed(const AuArray<AuUInt8, 64> &seed)
|
|
{
|
|
Reset();
|
|
this->seedMassive = seed;
|
|
this->secure = false;
|
|
}
|
|
|
|
inline auline void SetCSRNG()
|
|
{
|
|
this->secure = true;
|
|
Reset();
|
|
}
|
|
|
|
inline auline void Reset()
|
|
{
|
|
this->seed.reset();
|
|
this->seed64.reset();
|
|
this->seedMassive.reset();
|
|
}
|
|
};
|
|
} |