Jamie Reece Wilson
72a3513a04
[+] IRandomDevice::ToStreamReader [+] AuIO::Adapters::NewRandomAdapter [+] AuIO::Adapters::NewNOPsReadAdapter [+] AuIO::Adapters::NewNOPsSeekingAdapter [+] AuIO::Adapters::NewNOPsWriteAdapter [+] AuIO::Adapters::NewZerosReadAdapter [+] AuIO::Adapters::NewZerosSeekingAdapter
57 lines
2.2 KiB
C++
57 lines
2.2 KiB
C++
/***
|
|
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"
|
|
#include <Source/IO/Adapters/AuIOAdapterRandom.hpp>
|
|
|
|
namespace Aurora::RNG
|
|
{
|
|
struct RandomDevice :
|
|
IRandomDevice,
|
|
IO::Adapters::RandomStreamReader
|
|
{
|
|
RandomDevice();
|
|
RandomDevice(const RandomDef & def);
|
|
|
|
void Read(Memory::MemoryViewWrite view) override;
|
|
|
|
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;
|
|
|
|
double NextDecimal() override;
|
|
double NextNumber(double dMin, double dMax) override;
|
|
AuUInt32 NextIndex(AuUInt32 uCount /* = max + 1*/) override;
|
|
uuids::uuid NextUUID() override;
|
|
IO::IStreamReader *ToStreamReader() override;
|
|
AuMemoryViewRead ToSeed() override;
|
|
|
|
void Init(const RandomDef &def);
|
|
|
|
private:
|
|
RandomDef def_;
|
|
WELLRand fast_;
|
|
|
|
bool DecGeometric(int x);
|
|
double UniformFloatInRange(double udMin, double udMax);
|
|
};
|
|
} |