[+] IRandomDevice::ToSeed()
This commit is contained in:
parent
dbbcd14b57
commit
dcc9205ea6
@ -24,6 +24,8 @@ namespace Aurora::RNG
|
||||
virtual double NextDecimal() = 0;
|
||||
virtual float NextNumber(float min, float max) = 0;
|
||||
virtual AuUInt32 NextIndex(AuUInt32 uCount /* = max + 1*/) = 0;
|
||||
|
||||
virtual Memory::MemoryViewRead ToSeed() = 0;
|
||||
|
||||
template<typename T, int N>
|
||||
inline void NextFillArray(T(&array)[N])
|
||||
|
@ -144,7 +144,17 @@ namespace Aurora::RNG
|
||||
auto range = max - min;
|
||||
return NextDecimal() * range + min;
|
||||
}
|
||||
|
||||
|
||||
AuMemoryViewRead RandomDevice::ToSeed()
|
||||
{
|
||||
if (this->def_.bSecure)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
return this->fast_.state;
|
||||
}
|
||||
|
||||
AUKN_SYM IRandomDevice *RandomNew(const Aurora::RNG::RandomDef &def)
|
||||
{
|
||||
auto pDevice = _new RandomDevice();
|
||||
@ -158,8 +168,8 @@ namespace Aurora::RNG
|
||||
return pDevice;
|
||||
}
|
||||
|
||||
AUKN_SYM void RandomRelease(IRandomDevice *pStream)
|
||||
AUKN_SYM void RandomRelease(IRandomDevice *pDevice)
|
||||
{
|
||||
AuSafeDelete<RandomDevice*>(pStream);
|
||||
AuSafeDelete<RandomDevice *>(pDevice);
|
||||
}
|
||||
}
|
@ -27,6 +27,8 @@ namespace Aurora::RNG
|
||||
float NextNumber(float min, float max) override;
|
||||
AuUInt32 NextIndex(AuUInt32 uCount /* = max + 1*/) override;
|
||||
|
||||
AuMemoryViewRead ToSeed() override;
|
||||
|
||||
void Init(const RandomDef &def);
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user