AuroraRuntime/Source/RNG/AuRandomDevice.hpp

44 lines
1.3 KiB
C++
Raw Normal View History

2022-11-17 07:46:07 +00:00
/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuRandomDevice.hpp
Date: 2021-9-3
Author: Reece
***/
#pragma once
#include "AuWELL.hpp"
namespace Aurora::RNG
{
struct RandomDevice : IRandomDevice
{
2023-10-17 09:03:15 +00:00
RandomDevice();
RandomDevice(const RandomDef & def);
void Read(Memory::MemoryViewWrite view) override;
2022-11-17 07:46:07 +00:00
AuString NextString(AuUInt32 uLength, ERngStringCharacters type) override;
void NextString(char *pString, AuUInt32 uLength, ERngStringCharacters type) override;
AuUInt8 NextByte() override;
bool NextBoolean() override;
AuUInt32 NextU32() override;
AuUInt64 NextU64() override;
AuInt32 NextInt(AuInt32 iMin, AuInt32 iMax) override;
2022-11-17 07:46:07 +00:00
AuUInt32 NextU32(AuUInt32 uMin, AuUInt32 uMax) override;
double NextDecimal() override;
double NextNumber(double dMin, double dMax) override;
2022-11-17 07:46:07 +00:00
AuUInt32 NextIndex(AuUInt32 uCount /* = max + 1*/) override;
2022-12-28 20:07:41 +00:00
AuMemoryViewRead ToSeed() override;
2022-11-17 07:46:07 +00:00
void Init(const RandomDef &def);
private:
RandomDef def_;
WELLRand fast_;
bool DecGeometric(int x);
double UniformFloatInRange(double udMin, double udMax);
2022-11-17 07:46:07 +00:00
};
}