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"
|
2024-01-03 23:52:57 +00:00
|
|
|
#include <Source/IO/Adapters/AuIOAdapterRandom.hpp>
|
2022-11-17 07:46:07 +00:00
|
|
|
|
|
|
|
namespace Aurora::RNG
|
|
|
|
{
|
2024-01-03 23:52:57 +00:00
|
|
|
struct RandomDevice :
|
|
|
|
IRandomDevice,
|
|
|
|
IO::Adapters::RandomStreamReader
|
2022-11-17 07:46:07 +00:00
|
|
|
{
|
2023-10-17 09:03:15 +00:00
|
|
|
RandomDevice();
|
|
|
|
RandomDevice(const RandomDef & def);
|
|
|
|
|
2023-01-15 06:05:22 +00:00
|
|
|
void Read(Memory::MemoryViewWrite view) override;
|
2022-11-17 07:46:07 +00:00
|
|
|
|
2024-01-01 14:10:42 +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 NextI32Range(AuInt32 iMin, AuInt32 iMax) override;
|
|
|
|
AuUInt32 NextU32Range(AuUInt32 uMin, AuUInt32 uMax) override;
|
|
|
|
AuList<AuInt32> NextArrayI32Range(AuUInt32 uCount, AuInt32 iMin, AuInt32 iMax) override;
|
|
|
|
AuList<AuUInt32> NextArrayU32Range(AuUInt32 uCount, AuUInt32 uMin, AuUInt32 uMax) override;
|
|
|
|
AuList<double> NextArrayDoubleRange(AuUInt32 uCount, double dMin, double dMax) override;
|
|
|
|
AuList<AuInt32> NextArrayI32(AuUInt32 uCount) override;
|
|
|
|
AuList<AuUInt32> NextArrayU32(AuUInt32 uCount) override;
|
|
|
|
AuList<double> NextArrayDouble(AuUInt32 uCount) override;
|
|
|
|
AuList<double> NextArrayDecimals(AuUInt32 uCount) override;
|
|
|
|
AuList<uuids::uuid> NextArrayUUIDs(AuUInt32 uCount) override;
|
|
|
|
|
2022-11-17 07:46:07 +00:00
|
|
|
double NextDecimal() override;
|
2023-12-01 03:04:26 +00:00
|
|
|
double NextNumber(double dMin, double dMax) override;
|
2022-11-17 07:46:07 +00:00
|
|
|
AuUInt32 NextIndex(AuUInt32 uCount /* = max + 1*/) override;
|
2023-12-29 22:57:25 +00:00
|
|
|
uuids::uuid NextUUID() override;
|
2024-01-03 23:52:57 +00:00
|
|
|
IO::IStreamReader *ToStreamReader() 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_;
|
2023-12-01 03:04:26 +00:00
|
|
|
|
|
|
|
bool DecGeometric(int x);
|
|
|
|
double UniformFloatInRange(double udMin, double udMax);
|
2022-11-17 07:46:07 +00:00
|
|
|
};
|
|
|
|
}
|