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;
|
2024-04-22 05:02:56 +00:00
|
|
|
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;
|
2024-01-01 14:10:42 +00:00
|
|
|
AuInt32 NextI32Range(AuInt32 iMin, AuInt32 iMax) override;
|
|
|
|
AuUInt32 NextU32Range(AuUInt32 uMin, AuUInt32 uMax) override;
|
2024-09-05 21:50:02 +00:00
|
|
|
AuVecD2 NextVecD2(AuVecD2 boundA, AuVecD2 boundB) override;
|
|
|
|
AuVecD2 NextVecD2Sorted(AuVecD2 min, AuVecD2 max) override;
|
|
|
|
AuVecD3 NextVecD3(AuVecD3 boundA, AuVecD3 boundB) override;
|
|
|
|
AuVecD3 NextVecD3Sorted(AuVecD3 min, AuVecD3 max) override;
|
|
|
|
AuVecD4 NextVecD4(AuVecD4 boundA, AuVecD4 boundB) override;
|
|
|
|
AuVecD4 NextVecD4Sorted(AuVecD4 min, AuVecD4 max) override;
|
2024-01-01 14:10:42 +00:00
|
|
|
AuList<AuInt32> NextArrayI32Range(AuUInt32 uCount, AuInt32 iMin, AuInt32 iMax) override;
|
|
|
|
AuList<AuUInt32> NextArrayU32Range(AuUInt32 uCount, AuUInt32 uMin, AuUInt32 uMax) override;
|
2024-04-22 05:02:56 +00:00
|
|
|
AuList<AuInt64> NextArrayI64Range(AuUInt32 uCount, AuInt64 uMin, AuInt64 uMax) override;
|
|
|
|
AuList<AuUInt64> NextArrayU64Range(AuUInt32 uCount, AuUInt64 uMin, AuUInt64 uMax) override;
|
|
|
|
AuList<AuUInt32> NextArrayU32Mask(AuUInt32 uCount, AuUInt32 uMask) override;
|
|
|
|
AuList<AuUInt64> NextArrayU64Mask(AuUInt32 uCount, AuUInt64 uMask) override;
|
2024-01-01 14:10:42 +00:00
|
|
|
AuList<double> NextArrayDoubleRange(AuUInt32 uCount, double dMin, double dMax) override;
|
2024-04-22 05:02:56 +00:00
|
|
|
AuList<double> NextArrayDoubleRangeFast(AuUInt32 uCount, double dMin, double dMax) override;
|
2024-01-01 14:10:42 +00:00
|
|
|
AuList<AuInt32> NextArrayI32(AuUInt32 uCount) override;
|
|
|
|
AuList<AuUInt32> NextArrayU32(AuUInt32 uCount) override;
|
2024-04-22 05:02:56 +00:00
|
|
|
AuList<AuInt64> NextArrayI64(AuUInt32 uCount) override;
|
|
|
|
AuList<AuUInt64> NextArrayU64(AuUInt32 uCount) override;
|
|
|
|
AuList<AuVec2> NextArrayVec2(AuUInt32 uCount, AuVec2 boundA, AuVec2 boundB) override;
|
2024-04-24 13:33:06 +00:00
|
|
|
AuList<AuVec2> NextArrayVec2Fast(AuUInt32 uCount, AuVec2 boundA, AuVec2 boundB) override;
|
2024-04-22 05:02:56 +00:00
|
|
|
AuList<AuVec2> NextArrayVec2Sorted(AuUInt32 uCount, AuVec2 min, AuVec2 max) override;
|
|
|
|
AuList<AuVec2> NextArrayVec2SortedFast(AuUInt32 uCount, AuVec2 min, AuVec2 max) override;
|
|
|
|
AuList<AuVec3> NextArrayVec3(AuUInt32 uCount, AuVec3 boundA, AuVec3 boundB) override;
|
2024-04-24 13:33:06 +00:00
|
|
|
AuList<AuVec3> NextArrayVec3Fast(AuUInt32 uCount, AuVec3 boundA, AuVec3 boundB) override;
|
2024-04-22 05:02:56 +00:00
|
|
|
AuList<AuVec3> NextArrayVec3Sorted(AuUInt32 uCount, AuVec3 min, AuVec3 max) override;
|
|
|
|
AuList<AuVec3> NextArrayVec3SortedFast(AuUInt32 uCount, AuVec3 min, AuVec3 max) override;
|
|
|
|
AuList<AuVec4> NextArrayVec4(AuUInt32 uCount, AuVec4 boundA, AuVec4 boundB) override;
|
2024-04-24 13:33:06 +00:00
|
|
|
AuList<AuVec4> NextArrayVec4Fast(AuUInt32 uCount, AuVec4 boundA, AuVec4 boundB) override;
|
2024-04-22 05:02:56 +00:00
|
|
|
AuList<AuVec4> NextArrayVec4Sorted(AuUInt32 uCount, AuVec4 min, AuVec4 max) override;
|
|
|
|
AuList<AuVec4> NextArrayVec4SortedFast(AuUInt32 uCount, AuVec4 min, AuVec4 max) override;
|
2024-09-05 21:50:02 +00:00
|
|
|
AuList<AuVecD2> NextArrayVecD2(AuUInt32 uCount, AuVecD2 boundA, AuVecD2 boundB) override;
|
|
|
|
AuList<AuVecD2> NextArrayVecD2Fast(AuUInt32 uCount, AuVecD2 boundA, AuVecD2 boundB) override;
|
|
|
|
AuList<AuVecD2> NextArrayVecD2Sorted(AuUInt32 uCount, AuVecD2 min, AuVecD2 max) override;
|
|
|
|
AuList<AuVecD2> NextArrayVecD2SortedFast(AuUInt32 uCount, AuVecD2 min, AuVecD2 max) override;
|
|
|
|
AuList<AuVecD3> NextArrayVecD3(AuUInt32 uCount, AuVecD3 boundA, AuVecD3 boundB) override;
|
|
|
|
AuList<AuVecD3> NextArrayVecD3Fast(AuUInt32 uCount, AuVecD3 boundA, AuVecD3 boundB) override;
|
|
|
|
AuList<AuVecD3> NextArrayVecD3Sorted(AuUInt32 uCount, AuVecD3 min, AuVecD3 max) override;
|
|
|
|
AuList<AuVecD3> NextArrayVecD3SortedFast(AuUInt32 uCount, AuVecD3 min, AuVecD3 max) override;
|
|
|
|
AuList<AuVecD4> NextArrayVecD4(AuUInt32 uCount, AuVecD4 boundA, AuVecD4 boundB) override;
|
|
|
|
AuList<AuVecD4> NextArrayVecD4Fast(AuUInt32 uCount, AuVecD4 boundA, AuVecD4 boundB) override;
|
|
|
|
AuList<AuVecD4> NextArrayVecD4Sorted(AuUInt32 uCount, AuVecD4 min, AuVecD4 max) override;
|
|
|
|
AuList<AuVecD4> NextArrayVecD4SortedFast(AuUInt32 uCount, AuVecD4 min, AuVecD4 max) override;
|
2024-01-01 14:10:42 +00:00
|
|
|
AuList<double> NextArrayDouble(AuUInt32 uCount) override;
|
|
|
|
AuList<double> NextArrayDecimals(AuUInt32 uCount) override;
|
2024-04-22 05:02:56 +00:00
|
|
|
AuList<double> NextArrayDecimalsFast(AuUInt32 uCount) override;
|
2024-01-01 14:10:42 +00:00
|
|
|
AuList<uuids::uuid> NextArrayUUIDs(AuUInt32 uCount) override;
|
2024-04-22 20:54:05 +00:00
|
|
|
AuList<AuInt32> NextArrayI32RangeFast(AuUInt32 uCount, AuInt32 iMin, AuInt32 iMax) override;
|
|
|
|
AuList<AuUInt32> NextArrayU32RangeFast(AuUInt32 uCount, AuUInt32 uMin, AuUInt32 uMax) override;
|
|
|
|
AuList<AuInt64> NextArrayI64RangeFast(AuUInt32 uCount, AuInt64 iMin, AuInt64 iMax) override;
|
|
|
|
AuList<AuUInt64> NextArrayU64RangeFast(AuUInt32 uCount, AuUInt64 uMin, AuUInt64 uMax) override;
|
2024-07-21 02:37:07 +00:00
|
|
|
AuUInt NextArrayI32RangeInView(Memory::MemoryViewWrite write, AuInt32 iMin, AuInt32 iMax) override;
|
|
|
|
AuUInt NextArrayI32RangeFastInView(Memory::MemoryViewWrite write, AuInt32 iMin, AuInt32 iMax) override;
|
|
|
|
AuUInt NextArrayU32RangeInView(Memory::MemoryViewWrite write, AuUInt32 uMin, AuUInt32 uMax) override;
|
|
|
|
AuUInt NextArrayU32RangeFastInView(Memory::MemoryViewWrite write, AuUInt32 uMin, AuUInt32 uMax) override;
|
|
|
|
AuUInt NextArrayI64RangeInView(Memory::MemoryViewWrite write, AuInt64 iMin, AuInt64 iMax) override;
|
|
|
|
AuUInt NextArrayI64RangeFastInView(Memory::MemoryViewWrite write, AuInt64 iMin, AuInt64 iMax) override;
|
|
|
|
AuUInt NextArrayU64RangeInView(Memory::MemoryViewWrite write, AuUInt64 uMin, AuUInt64 uMax) override;
|
|
|
|
AuUInt NextArrayU64RangeFastInView(Memory::MemoryViewWrite write, AuUInt64 uMin, AuUInt64 uMax) override;
|
|
|
|
AuUInt NextArrayU32MaskInView(Memory::MemoryViewWrite write, AuUInt32 uMask) override;
|
|
|
|
AuUInt NextArrayU64MaskInView(Memory::MemoryViewWrite write, AuUInt64 uMask) override;
|
|
|
|
AuUInt NextArrayDoubleRangeInView(Memory::MemoryViewWrite write, double dMin, double dMax) override;
|
|
|
|
AuUInt NextArrayDoubleRangeFastInView(Memory::MemoryViewWrite write, double dMin, double dMax) override;
|
|
|
|
AuUInt NextArrayI32InView(Memory::MemoryViewWrite write) override;
|
|
|
|
AuUInt NextArrayU32InView(Memory::MemoryViewWrite write) override;
|
|
|
|
AuUInt NextArrayI64InView(Memory::MemoryViewWrite write) override;
|
|
|
|
AuUInt NextArrayU64InView(Memory::MemoryViewWrite write) override;
|
|
|
|
AuUInt NextArrayVec2InView(Memory::MemoryViewWrite write, AuVec2 boundA, AuVec2 boundB) override;
|
|
|
|
AuUInt NextArrayVec2FastInView(Memory::MemoryViewWrite write, AuVec2 boundA, AuVec2 boundB) override;
|
|
|
|
AuUInt NextArrayVec2SortedInView(Memory::MemoryViewWrite write, AuVec2 min, AuVec2 max) override;
|
|
|
|
AuUInt NextArrayVec2SortedFastInView(Memory::MemoryViewWrite write, AuVec2 min, AuVec2 max) override;
|
|
|
|
AuUInt NextArrayVec3InView(Memory::MemoryViewWrite write, AuVec3 boundA, AuVec3 boundB) override;
|
|
|
|
AuUInt NextArrayVec3FastInView(Memory::MemoryViewWrite write, AuVec3 boundA, AuVec3 boundB) override;
|
|
|
|
AuUInt NextArrayVec3SortedInView(Memory::MemoryViewWrite write, AuVec3 min, AuVec3 max) override;
|
|
|
|
AuUInt NextArrayVec3SortedFastInView(Memory::MemoryViewWrite write, AuVec3 min, AuVec3 max) override;
|
|
|
|
AuUInt NextArrayVec4InView(Memory::MemoryViewWrite write, AuVec4 boundA, AuVec4 boundB) override;
|
|
|
|
AuUInt NextArrayVec4FastInView(Memory::MemoryViewWrite write, AuVec4 boundA, AuVec4 boundB) override;
|
|
|
|
AuUInt NextArrayVec4SortedInView(Memory::MemoryViewWrite write, AuVec4 min, AuVec4 max) override;
|
|
|
|
AuUInt NextArrayVec4SortedFastInView(Memory::MemoryViewWrite write, AuVec4 min, AuVec4 max) override;
|
2024-09-05 21:50:02 +00:00
|
|
|
AuUInt NextArrayVecD2InView(Memory::MemoryViewWrite write, AuVecD2 boundA, AuVecD2 boundB) override;
|
|
|
|
AuUInt NextArrayVecD2FastInView(Memory::MemoryViewWrite write, AuVecD2 boundA, AuVecD2 boundB) override;
|
|
|
|
AuUInt NextArrayVecD2SortedInView(Memory::MemoryViewWrite write, AuVecD2 min, AuVecD2 max) override;
|
|
|
|
AuUInt NextArrayVecD2SortedFastInView(Memory::MemoryViewWrite write, AuVecD2 min, AuVecD2 max) override;
|
|
|
|
AuUInt NextArrayVecD3InView(Memory::MemoryViewWrite write, AuVecD3 boundA, AuVecD3 boundB) override;
|
|
|
|
AuUInt NextArrayVecD3FastInView(Memory::MemoryViewWrite write, AuVecD3 boundA, AuVecD3 boundB) override;
|
|
|
|
AuUInt NextArrayVecD3SortedInView(Memory::MemoryViewWrite write, AuVecD3 min, AuVecD3 max) override;
|
|
|
|
AuUInt NextArrayVecD3SortedFastInView(Memory::MemoryViewWrite write, AuVecD3 min, AuVecD3 max) override;
|
|
|
|
AuUInt NextArrayVecD4InView(Memory::MemoryViewWrite write, AuVecD4 boundA, AuVecD4 boundB) override;
|
|
|
|
AuUInt NextArrayVecD4FastInView(Memory::MemoryViewWrite write, AuVecD4 boundA, AuVecD4 boundB) override;
|
|
|
|
AuUInt NextArrayVecD4SortedInView(Memory::MemoryViewWrite write, AuVecD4 min, AuVecD4 max) override;
|
|
|
|
AuUInt NextArrayVecD4SortedFastInView(Memory::MemoryViewWrite write, AuVecD4 min, AuVecD4 max) override;
|
2024-07-21 02:37:07 +00:00
|
|
|
AuUInt NextArrayDoubleInView(Memory::MemoryViewWrite write) override;
|
|
|
|
AuUInt NextArrayDecimalsInView(Memory::MemoryViewWrite write) override;
|
|
|
|
AuUInt NextArrayDecimalsFastInView(Memory::MemoryViewWrite write) override;
|
|
|
|
AuUInt NextArrayUUIDsInView(Memory::MemoryViewWrite write) override;
|
2024-01-01 14:10:42 +00:00
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|