/*** 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 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; AuUInt64 NextU64Range(AuUInt64 uMin, AuUInt64 uMax) override; AuInt64 NextI64Range(AuInt64 iMin, AuInt64 iMax) override; AuVec2 NextVec2(AuVec2 boundA, AuVec2 boundB) override; AuVec2 NextVec2Sorted(AuVec2 min, AuVec2 max) override; AuVec3 NextVec3(AuVec3 boundA, AuVec3 boundB) override; AuVec3 NextVec3Sorted(AuVec3 min, AuVec3 max) override; AuVec4 NextVec4(AuVec4 boundA, AuVec4 boundB) override; AuVec4 NextVec4Sorted(AuVec4 min, AuVec4 max) override; AuInt32 NextI32Range(AuInt32 iMin, AuInt32 iMax) override; AuUInt32 NextU32Range(AuUInt32 uMin, AuUInt32 uMax) override; AuList NextArrayI32Range(AuUInt32 uCount, AuInt32 iMin, AuInt32 iMax) override; AuList NextArrayU32Range(AuUInt32 uCount, AuUInt32 uMin, AuUInt32 uMax) override; AuList NextArrayI64Range(AuUInt32 uCount, AuInt64 uMin, AuInt64 uMax) override; AuList NextArrayU64Range(AuUInt32 uCount, AuUInt64 uMin, AuUInt64 uMax) override; AuList NextArrayU32Mask(AuUInt32 uCount, AuUInt32 uMask) override; AuList NextArrayU64Mask(AuUInt32 uCount, AuUInt64 uMask) override; AuList NextArrayDoubleRange(AuUInt32 uCount, double dMin, double dMax) override; AuList NextArrayDoubleRangeFast(AuUInt32 uCount, double dMin, double dMax) override; AuList NextArrayI32(AuUInt32 uCount) override; AuList NextArrayU32(AuUInt32 uCount) override; AuList NextArrayI64(AuUInt32 uCount) override; AuList NextArrayU64(AuUInt32 uCount) override; AuList NextArrayVec2(AuUInt32 uCount, AuVec2 boundA, AuVec2 boundB) override; AuList NextArrayVec2Fast(AuUInt32 uCount, AuVec2 boundA, AuVec2 boundB) override; AuList NextArrayVec2Sorted(AuUInt32 uCount, AuVec2 min, AuVec2 max) override; AuList NextArrayVec2SortedFast(AuUInt32 uCount, AuVec2 min, AuVec2 max) override; AuList NextArrayVec3(AuUInt32 uCount, AuVec3 boundA, AuVec3 boundB) override; AuList NextArrayVec3Fast(AuUInt32 uCount, AuVec3 boundA, AuVec3 boundB) override; AuList NextArrayVec3Sorted(AuUInt32 uCount, AuVec3 min, AuVec3 max) override; AuList NextArrayVec3SortedFast(AuUInt32 uCount, AuVec3 min, AuVec3 max) override; AuList NextArrayVec4(AuUInt32 uCount, AuVec4 boundA, AuVec4 boundB) override; AuList NextArrayVec4Fast(AuUInt32 uCount, AuVec4 boundA, AuVec4 boundB) override; AuList NextArrayVec4Sorted(AuUInt32 uCount, AuVec4 min, AuVec4 max) override; AuList NextArrayVec4SortedFast(AuUInt32 uCount, AuVec4 min, AuVec4 max) override; AuList NextArrayDouble(AuUInt32 uCount) override; AuList NextArrayDecimals(AuUInt32 uCount) override; AuList NextArrayDecimalsFast(AuUInt32 uCount) override; AuList NextArrayUUIDs(AuUInt32 uCount) override; AuList NextArrayI32RangeFast(AuUInt32 uCount, AuInt32 iMin, AuInt32 iMax) override; AuList NextArrayU32RangeFast(AuUInt32 uCount, AuUInt32 uMin, AuUInt32 uMax) override; AuList NextArrayI64RangeFast(AuUInt32 uCount, AuInt64 iMin, AuInt64 iMax) override; AuList NextArrayU64RangeFast(AuUInt32 uCount, AuUInt64 uMin, AuUInt64 uMax) 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); }; }