From 0c2d69376e331f1233376b39aa106b6cc5aeec3a Mon Sep 17 00:00:00 2001 From: Jamie Reece Wilson Date: Sun, 21 Jul 2024 03:37:07 +0100 Subject: [PATCH] [+] AuRNG::IRandomDevice::...InView [+] AuRNG::...InView --- Include/Aurora/RNG/IRandomDevice.hpp | 62 +- Include/Aurora/RNG/RNG.hpp | 34 +- Source/RNG/AuRNGStaticUtilities.cpp | 160 +++ Source/RNG/AuRandomDevice.cpp | 1615 +++++++++++++++----------- Source/RNG/AuRandomDevice.hpp | 32 + 5 files changed, 1247 insertions(+), 656 deletions(-) diff --git a/Include/Aurora/RNG/IRandomDevice.hpp b/Include/Aurora/RNG/IRandomDevice.hpp index 01a0947d..ca24537b 100644 --- a/Include/Aurora/RNG/IRandomDevice.hpp +++ b/Include/Aurora/RNG/IRandomDevice.hpp @@ -13,10 +13,14 @@ namespace Aurora::RNG struct IRandomDevice { + virtual IO::IStreamReader * ToStreamReader() = 0; + virtual Memory::MemoryViewRead ToSeed() = 0; + virtual void Read(Memory::MemoryViewWrite view) = 0; virtual AuString NextString(AuUInt32 uLength, ERngStringCharacters type = ERngStringCharacters::eAlphaCharacters) = 0; virtual void NextString(char *pString, AuUInt32 uLength, ERngStringCharacters type = ERngStringCharacters::eAlphaCharacters) = 0; + virtual AuUInt8 NextByte() = 0; virtual bool NextBoolean() = 0; virtual AuUInt32 NextU32() = 0; @@ -35,6 +39,30 @@ namespace Aurora::RNG virtual double NextNumber(double dMin, double dMax) = 0; virtual AuUInt32 NextIndex(AuUInt32 uCount /* = max + 1*/) = 0; virtual uuids::uuid NextUUID() = 0; + + // Note: Fast arrays are deterministic with little seed entropy (usually 64bits, sometimes 32bits). + // + // Wont mitigate; use the slower non-fast variants if each numeric value (if not vec) OR + // a *group* of N-components of each vector (if vec) need to be unique. + // + // Fast arrays simply rehash the previous bits to get the next component. While hopefully + // perfectly uniform (otherwise the hash wouldn't be a good hash), it's entirely possible + // to extrapolate the next value in the sequence. + // + // In addition, this applies to non-fast components of each vector; given an X component, + // you can derive the Y and Z, even under non-fast functions. Fast vectors means the next + // vector can be extrapolated from the previous group of vector components; nonfast, you + // can only solve Y and Z. Fast vector arrays only have 64bits of entropy extrapolated to + // 52bits * uCount * N bits of fully deterministic components; nonfast vector arrays have + // 64bits * uCount bits of entropy, extrapolated to 52bits * uCount * N bits of partially + // in-vector extrapolatable bits. + // + // Also note, it might not even be possible to extrapolate these components in practice. + // This is because each component has some bits chucked away when shoving the seed into + // the mantissa, and then each component gets manipulated using the same range provided + // by the bound[..]s or min/max vecs parameters. Some bruteforce would be required. + // + virtual AuList NextArrayI32Range(AuUInt32 uCount, AuInt32 iMin, AuInt32 iMax) = 0; virtual AuList NextArrayI32RangeFast(AuUInt32 uCount, AuInt32 iMin, AuInt32 iMax) = 0; virtual AuList NextArrayU32Range(AuUInt32 uCount, AuUInt32 uMin, AuUInt32 uMax) = 0; @@ -67,9 +95,39 @@ namespace Aurora::RNG virtual AuList NextArrayDecimals(AuUInt32 uCount) = 0; virtual AuList NextArrayDecimalsFast(AuUInt32 uCount) = 0; virtual AuList NextArrayUUIDs(AuUInt32 uCount) = 0; + virtual AuUInt NextArrayI32RangeInView(Memory::MemoryViewWrite write, AuInt32 iMin, AuInt32 iMax) = 0; + virtual AuUInt NextArrayI32RangeFastInView(Memory::MemoryViewWrite write, AuInt32 iMin, AuInt32 iMax) = 0; + virtual AuUInt NextArrayU32RangeInView(Memory::MemoryViewWrite write, AuUInt32 uMin, AuUInt32 uMax) = 0; + virtual AuUInt NextArrayU32RangeFastInView(Memory::MemoryViewWrite write, AuUInt32 uMin, AuUInt32 uMax) = 0; + virtual AuUInt NextArrayI64RangeInView(Memory::MemoryViewWrite write, AuInt64 iMin, AuInt64 iMax) = 0; + virtual AuUInt NextArrayI64RangeFastInView(Memory::MemoryViewWrite write, AuInt64 iMin, AuInt64 iMax) = 0; + virtual AuUInt NextArrayU64RangeInView(Memory::MemoryViewWrite write, AuUInt64 uMin, AuUInt64 uMax) = 0; + virtual AuUInt NextArrayU64RangeFastInView(Memory::MemoryViewWrite write, AuUInt64 uMin, AuUInt64 uMax) = 0; + virtual AuUInt NextArrayU32MaskInView(Memory::MemoryViewWrite write, AuUInt32 uMask) = 0; + virtual AuUInt NextArrayU64MaskInView(Memory::MemoryViewWrite write, AuUInt64 uMask) = 0; + virtual AuUInt NextArrayDoubleRangeInView(Memory::MemoryViewWrite write, double dMin, double dMax) = 0; + virtual AuUInt NextArrayDoubleRangeFastInView(Memory::MemoryViewWrite write, double dMin, double dMax) = 0; + virtual AuUInt NextArrayI32InView(Memory::MemoryViewWrite write) = 0; + virtual AuUInt NextArrayU32InView(Memory::MemoryViewWrite write) = 0; + virtual AuUInt NextArrayI64InView(Memory::MemoryViewWrite write) = 0; + virtual AuUInt NextArrayU64InView(Memory::MemoryViewWrite write) = 0; + virtual AuUInt NextArrayVec2InView(Memory::MemoryViewWrite write, AuVec2 boundA, AuVec2 boundB) = 0; + virtual AuUInt NextArrayVec2FastInView(Memory::MemoryViewWrite write, AuVec2 boundA, AuVec2 boundB) = 0; + virtual AuUInt NextArrayVec2SortedInView(Memory::MemoryViewWrite write, AuVec2 min, AuVec2 max) = 0; + virtual AuUInt NextArrayVec2SortedFastInView(Memory::MemoryViewWrite write, AuVec2 min, AuVec2 max) = 0; + virtual AuUInt NextArrayVec3InView(Memory::MemoryViewWrite write, AuVec3 boundA, AuVec3 boundB) = 0; + virtual AuUInt NextArrayVec3FastInView(Memory::MemoryViewWrite write, AuVec3 boundA, AuVec3 boundB) = 0; + virtual AuUInt NextArrayVec3SortedInView(Memory::MemoryViewWrite write, AuVec3 min, AuVec3 max) = 0; + virtual AuUInt NextArrayVec3SortedFastInView(Memory::MemoryViewWrite write, AuVec3 min, AuVec3 max) = 0; + virtual AuUInt NextArrayVec4InView(Memory::MemoryViewWrite write, AuVec4 boundA, AuVec4 boundB) = 0; + virtual AuUInt NextArrayVec4FastInView(Memory::MemoryViewWrite write, AuVec4 boundA, AuVec4 boundB) = 0; + virtual AuUInt NextArrayVec4SortedInView(Memory::MemoryViewWrite write, AuVec4 min, AuVec4 max) = 0; + virtual AuUInt NextArrayVec4SortedFastInView(Memory::MemoryViewWrite write, AuVec4 min, AuVec4 max) = 0; + virtual AuUInt NextArrayDoubleInView(Memory::MemoryViewWrite write) = 0; + virtual AuUInt NextArrayDecimalsInView(Memory::MemoryViewWrite write) = 0; + virtual AuUInt NextArrayDecimalsFastInView(Memory::MemoryViewWrite write) = 0; + virtual AuUInt NextArrayUUIDsInView(Memory::MemoryViewWrite write) = 0; - virtual IO::IStreamReader *ToStreamReader() = 0; - virtual Memory::MemoryViewRead ToSeed() = 0; template inline void NextFillArray(T(&array)[N]) diff --git a/Include/Aurora/RNG/RNG.hpp b/Include/Aurora/RNG/RNG.hpp index 56d1e6a1..2482d163 100644 --- a/Include/Aurora/RNG/RNG.hpp +++ b/Include/Aurora/RNG/RNG.hpp @@ -76,8 +76,40 @@ namespace Aurora::RNG AUKN_SYM AuList RngArrayDecimals(AuUInt32 uCount); AUKN_SYM AuList RngArrayDecimalsFast(AuUInt32 uCount); AUKN_SYM AuList RngArrayUUIDs(AuUInt32 uCount); - // Note: it is conceivable that someone may want the following templates for some cryptographic purpose + AUKN_SYM AuUInt RngArrayI32RangeInView(Memory::MemoryViewWrite write, AuInt32 iMin, AuInt32 iMax); + AUKN_SYM AuUInt RngArrayI32RangeFastInView(Memory::MemoryViewWrite write, AuInt32 iMin, AuInt32 iMax); + AUKN_SYM AuUInt RngArrayU32RangeInView(Memory::MemoryViewWrite write, AuUInt32 uMin, AuUInt32 uMax); + AUKN_SYM AuUInt RngArrayU32RangeFastInView(Memory::MemoryViewWrite write, AuUInt32 uMin, AuUInt32 uMax); + AUKN_SYM AuUInt RngArrayI64RangeInView(Memory::MemoryViewWrite write, AuInt64 iMin, AuInt64 iMax); + AUKN_SYM AuUInt RngArrayI64RangeFastInView(Memory::MemoryViewWrite write, AuInt64 iMin, AuInt64 iMax); + AUKN_SYM AuUInt RngArrayU64RangeInView(Memory::MemoryViewWrite write, AuUInt64 uMin, AuUInt64 uMax); + AUKN_SYM AuUInt RngArrayU64RangeFastInView(Memory::MemoryViewWrite write, AuUInt64 uMin, AuUInt64 uMax); + AUKN_SYM AuUInt RngArrayU32MaskInView(Memory::MemoryViewWrite write, AuUInt32 uMask); + AUKN_SYM AuUInt RngArrayU64MaskInView(Memory::MemoryViewWrite write, AuUInt64 uMask); + AUKN_SYM AuUInt RngArrayDoubleRangeInView(Memory::MemoryViewWrite write, double dMin, double dMax); + AUKN_SYM AuUInt RngArrayDoubleRangeFastInView(Memory::MemoryViewWrite write, double dMin, double dMax); + AUKN_SYM AuUInt RngArrayI32InView(Memory::MemoryViewWrite write); + AUKN_SYM AuUInt RngArrayU32InView(Memory::MemoryViewWrite write); + AUKN_SYM AuUInt RngArrayI64InView(Memory::MemoryViewWrite write); + AUKN_SYM AuUInt RngArrayU64InView(Memory::MemoryViewWrite write); + AUKN_SYM AuUInt RngArrayVec2InView(Memory::MemoryViewWrite write, AuVec2 boundA, AuVec2 boundB); + AUKN_SYM AuUInt RngArrayVec2FastInView(Memory::MemoryViewWrite write, AuVec2 boundA, AuVec2 boundB); + AUKN_SYM AuUInt RngArrayVec2SortedInView(Memory::MemoryViewWrite write, AuVec2 min, AuVec2 max); + AUKN_SYM AuUInt RngArrayVec2SortedFastInView(Memory::MemoryViewWrite write, AuVec2 min, AuVec2 max); + AUKN_SYM AuUInt RngArrayVec3InView(Memory::MemoryViewWrite write, AuVec3 boundA, AuVec3 boundB); + AUKN_SYM AuUInt RngArrayVec3FastInView(Memory::MemoryViewWrite write, AuVec3 boundA, AuVec3 boundB); + AUKN_SYM AuUInt RngArrayVec3SortedInView(Memory::MemoryViewWrite write, AuVec3 min, AuVec3 max); + AUKN_SYM AuUInt RngArrayVec3SortedFastInView(Memory::MemoryViewWrite write, AuVec3 min, AuVec3 max); + AUKN_SYM AuUInt RngArrayVec4InView(Memory::MemoryViewWrite write, AuVec4 boundA, AuVec4 boundB); + AUKN_SYM AuUInt RngArrayVec4FastInView(Memory::MemoryViewWrite write, AuVec4 boundA, AuVec4 boundB); + AUKN_SYM AuUInt RngArrayVec4SortedInView(Memory::MemoryViewWrite write, AuVec4 min, AuVec4 max); + AUKN_SYM AuUInt RngArrayVec4SortedFastInView(Memory::MemoryViewWrite write, AuVec4 min, AuVec4 max); + AUKN_SYM AuUInt RngArrayDoubleInView(Memory::MemoryViewWrite write); + AUKN_SYM AuUInt RngArrayDecimalsInView(Memory::MemoryViewWrite write); + AUKN_SYM AuUInt RngArrayDecimalsFastInView(Memory::MemoryViewWrite write); + AUKN_SYM AuUInt RngArrayUUIDsInView(Memory::MemoryViewWrite write); + // Note: it is conceivable that someone may want the following templates for some cryptographic purpose template static auline void RngFillArray(T(&array)[N]) { diff --git a/Source/RNG/AuRNGStaticUtilities.cpp b/Source/RNG/AuRNGStaticUtilities.cpp index 7460db92..4b095bec 100644 --- a/Source/RNG/AuRNGStaticUtilities.cpp +++ b/Source/RNG/AuRNGStaticUtilities.cpp @@ -272,4 +272,164 @@ namespace Aurora::RNG { return gFastDevice->NextArrayU64RangeFast(uCount, uMin, uMax); } + + AUKN_SYM AuUInt RngArrayI32RangeInView(Memory::MemoryViewWrite write, AuInt32 iMin, AuInt32 iMax) + { + return gFastDevice->NextArrayI32RangeInView(write, iMin, iMax); + } + + AUKN_SYM AuUInt RngArrayI32RangeFastInView(Memory::MemoryViewWrite write, AuInt32 iMin, AuInt32 iMax) + { + return gFastDevice->NextArrayI32RangeFastInView(write, iMin, iMax); + } + + AUKN_SYM AuUInt RngArrayU32RangeInView(Memory::MemoryViewWrite write, AuUInt32 uMin, AuUInt32 uMax) + { + return gFastDevice->NextArrayU32RangeInView(write, uMin, uMax); + } + + AUKN_SYM AuUInt RngArrayU32RangeFastInView(Memory::MemoryViewWrite write, AuUInt32 uMin, AuUInt32 uMax) + { + return gFastDevice->NextArrayU32RangeFastInView(write, uMin, uMax); + } + + AUKN_SYM AuUInt RngArrayI64RangeInView(Memory::MemoryViewWrite write, AuInt64 iMin, AuInt64 iMax) + { + return gFastDevice->NextArrayI64RangeInView(write, iMin, iMax); + } + + AUKN_SYM AuUInt RngArrayI64RangeFastInView(Memory::MemoryViewWrite write, AuInt64 iMin, AuInt64 iMax) + { + return gFastDevice->NextArrayI64RangeFastInView(write, iMin, iMax); + } + + AUKN_SYM AuUInt RngArrayU64RangeInView(Memory::MemoryViewWrite write, AuUInt64 uMin, AuUInt64 uMax) + { + return gFastDevice->NextArrayU64RangeInView(write, uMin, uMax); + } + + AUKN_SYM AuUInt RngArrayU64RangeFastInView(Memory::MemoryViewWrite write, AuUInt64 uMin, AuUInt64 uMax) + { + return gFastDevice->NextArrayU64RangeFastInView(write, uMin, uMax); + } + + AUKN_SYM AuUInt RngArrayU32MaskInView(Memory::MemoryViewWrite write, AuUInt32 uMask) + { + return gFastDevice->NextArrayU32MaskInView(write, uMask); + } + + AUKN_SYM AuUInt RngArrayU64MaskInView(Memory::MemoryViewWrite write, AuUInt64 uMask) + { + return gFastDevice->NextArrayU64MaskInView(write, uMask); + } + + AUKN_SYM AuUInt RngArrayDoubleRangeInView(Memory::MemoryViewWrite write, double dMin, double dMax) + { + return gFastDevice->NextArrayDoubleRangeInView(write, dMin, dMax); + } + + AUKN_SYM AuUInt RngArrayDoubleRangeFastInView(Memory::MemoryViewWrite write, double dMin, double dMax) + { + return gFastDevice->NextArrayDoubleRangeFastInView(write, dMin, dMax); + } + + AUKN_SYM AuUInt RngArrayI32InView(Memory::MemoryViewWrite write) + { + return gFastDevice->NextArrayI32InView(write); + } + + AUKN_SYM AuUInt RngArrayU32InView(Memory::MemoryViewWrite write) + { + return gFastDevice->NextArrayU32InView(write); + } + + AUKN_SYM AuUInt RngArrayI64InView(Memory::MemoryViewWrite write) + { + return gFastDevice->NextArrayI64InView(write); + } + + AUKN_SYM AuUInt RngArrayU64InView(Memory::MemoryViewWrite write) + { + return gFastDevice->NextArrayU64InView(write); + } + + AUKN_SYM AuUInt RngArrayVec2InView(Memory::MemoryViewWrite write, AuVec2 boundA, AuVec2 boundB) + { + return gFastDevice->NextArrayVec2InView(write, boundA, boundB); + } + + AUKN_SYM AuUInt RngArrayVec2FastInView(Memory::MemoryViewWrite write, AuVec2 boundA, AuVec2 boundB) + { + return gFastDevice->NextArrayVec2FastInView(write, boundA, boundB); + } + + AUKN_SYM AuUInt RngArrayVec2SortedInView(Memory::MemoryViewWrite write, AuVec2 min, AuVec2 max) + { + return gFastDevice->NextArrayVec2SortedInView(write, min, max); + } + + AUKN_SYM AuUInt RngArrayVec2SortedFastInView(Memory::MemoryViewWrite write, AuVec2 min, AuVec2 max) + { + return gFastDevice->NextArrayVec2SortedFastInView(write, min, max); + } + + AUKN_SYM AuUInt RngArrayVec3InView(Memory::MemoryViewWrite write, AuVec3 boundA, AuVec3 boundB) + { + return gFastDevice->NextArrayVec3InView(write, boundA, boundB); + } + + AUKN_SYM AuUInt RngArrayVec3FastInView(Memory::MemoryViewWrite write, AuVec3 boundA, AuVec3 boundB) + { + return gFastDevice->NextArrayVec3FastInView(write, boundA, boundB); + } + + AUKN_SYM AuUInt RngArrayVec3SortedInView(Memory::MemoryViewWrite write, AuVec3 min, AuVec3 max) + { + return gFastDevice->NextArrayVec3SortedInView(write, min, max); + } + + AUKN_SYM AuUInt RngArrayVec3SortedFastInView(Memory::MemoryViewWrite write, AuVec3 min, AuVec3 max) + { + return gFastDevice->NextArrayVec3SortedFastInView(write, min, max); + } + + AUKN_SYM AuUInt RngArrayVec4InView(Memory::MemoryViewWrite write, AuVec4 boundA, AuVec4 boundB) + { + return gFastDevice->NextArrayVec4InView(write, boundA, boundB); + } + + AUKN_SYM AuUInt RngArrayVec4FastInView(Memory::MemoryViewWrite write, AuVec4 boundA, AuVec4 boundB) + { + return gFastDevice->NextArrayVec4FastInView(write, boundA, boundB); + } + + AUKN_SYM AuUInt RngArrayVec4SortedInView(Memory::MemoryViewWrite write, AuVec4 min, AuVec4 max) + { + return gFastDevice->NextArrayVec4SortedInView(write, min, max); + } + + AUKN_SYM AuUInt RngArrayVec4SortedFastInView(Memory::MemoryViewWrite write, AuVec4 min, AuVec4 max) + { + return gFastDevice->NextArrayVec4SortedFastInView(write, min, max); + } + + AUKN_SYM AuUInt RngArrayDoubleInView(Memory::MemoryViewWrite write) + { + return gFastDevice->NextArrayDoubleInView(write); + } + + AUKN_SYM AuUInt RngArrayDecimalsInView(Memory::MemoryViewWrite write) + { + return gFastDevice->NextArrayDecimalsInView(write); + } + + AUKN_SYM AuUInt RngArrayDecimalsFastInView(Memory::MemoryViewWrite write) + { + return gFastDevice->NextArrayDecimalsFastInView(write); + } + + AUKN_SYM AuUInt RngArrayUUIDsInView(Memory::MemoryViewWrite write) + { + return gFastDevice->NextArrayUUIDsInView(write); + } } \ No newline at end of file diff --git a/Source/RNG/AuRandomDevice.cpp b/Source/RNG/AuRandomDevice.cpp index 69135100..f8ad0084 100644 --- a/Source/RNG/AuRandomDevice.cpp +++ b/Source/RNG/AuRandomDevice.cpp @@ -296,182 +296,6 @@ namespace Aurora::RNG #endif } - AuList RandomDevice::NextArrayI32Range(AuUInt32 uCount, AuInt32 iMin, AuInt32 iMax) - { - AuList ret; - AuList rngBytes; - - rngBytes.resize(uCount); - ret.resize(uCount); - this->Read(rngBytes); - - auto uRange = AuUInt32(iMax - iMin); - auto uUpperBound = AuRoundUpPow2(uRange + 1); - for (AU_ITERATE_N(uIndex, rngBytes.size())) - { - auto uMassiveWord = rngBytes[uIndex]; - AuUInt32 uNext {}; - while ((uNext = (uMassiveWord & (uUpperBound - 1))) > uRange) - { - uMassiveWord = AuFnv1a32Runtime(&uMassiveWord); - } - - ret[uIndex] = iMin + uNext; - } - - return ret; - } - - AuList RandomDevice::NextArrayI32RangeFast(AuUInt32 uCount, AuInt32 iMin, AuInt32 iMax) - { - AuList ret; - - ret.resize(uCount); - - auto uRange = AuUInt32(iMax - iMin); - auto uUpperBound = AuRoundUpPow2(uRange + 1); - auto uSeed = this->NextU32(); - - for (AU_ITERATE_N(uIndex, uCount)) - { - AuUInt32 uNext {}; - - uSeed = AuFnv1a32Runtime(&uSeed); - while ((uNext = (uSeed & (uUpperBound - 1))) > uRange) - { - uSeed = AuFnv1a32Runtime(&uSeed); - } - - ret[uIndex] = iMin + uNext; - } - - return ret; - } - - AuList RandomDevice::NextArrayU32Range(AuUInt32 uCount, AuUInt32 uMin, AuUInt32 uMax) - { - AuList ret; - AuList rngBytes; - - ret.resize(uCount); - rngBytes.resize(uCount); - this->Read(rngBytes); - - auto uRange = uMax - uMin; - auto uUpperBound = AuRoundUpPow2(uRange + 1); - - for (AU_ITERATE_N(uIndex, rngBytes.size())) - { - auto uMassiveWord = rngBytes[uIndex]; - AuUInt32 uNext {}; - while ((uNext = (uMassiveWord & (uUpperBound - 1))) > uRange) - { - uMassiveWord = AuFnv1a32Runtime(&uMassiveWord); - } - - ret[uIndex] = uMin + uNext; - } - - return ret; - } - - AuList RandomDevice::NextArrayU32RangeFast(AuUInt32 uCount, AuUInt32 uMin, AuUInt32 uMax) - { - AuList ret; - - ret.resize(uCount); - - auto uRange = uMax - uMin; - auto uUpperBound = AuRoundUpPow2(uRange + 1); - auto uSeed = this->NextU32(); - - for (AU_ITERATE_N(uIndex, uCount)) - { - AuUInt32 uNext {}; - - uSeed = AuFnv1a32Runtime(&uSeed); - while ((uNext = (uSeed & (uUpperBound - 1))) > uRange) - { - uSeed = AuFnv1a32Runtime(&uSeed); - } - - ret[uIndex] = uMin + uNext; - } - - return ret; - } - - AuList RandomDevice::NextArrayDoubleRange(AuUInt32 uCount, double dMin, double dMax) - { - #if defined(AURNG_USE_FAST_DECIMALS) - AuList ret; - AuList rngBytes; - - ret.resize(uCount); - rngBytes.resize(uCount); - this->Read(rngBytes); - - double dRange = dMax - dMin; - - for (AU_ITERATE_N(uIndex, rngBytes.size())) - { - double dValue = RngConvertToDecimal(rngBytes[uIndex]); - dValue *= dRange; - dValue += dMin; - ret[uIndex] = dValue; - } - - return ret; - #else - AuList ret; - ret.resize(uCount); - - for (AU_ITERATE_N(uIndex, uCount)) - { - ret[uIndex] = this->NextNumber(dMin, dMax); - } - - return ret; - #endif - } - - AuList RandomDevice::NextArrayDoubleRangeFast(AuUInt32 uCount, double dMin, double dMax) - { - AuList ret; - - ret.resize(uCount); - - AuUInt64 uSeed = this->NextU64(); - double dRange = dMax - dMin; - - for (AU_ITERATE_N(uIndex, uCount)) - { - double dValue = RngConvertToDecimal(uSeed); - dValue *= dRange; - dValue += dMin; - ret[uIndex] = dValue; - uSeed = AuFnv1a64Runtime<8>(&uSeed); - } - - return ret; - } - - AuList RandomDevice::NextArrayI32(AuUInt32 uCount) - { - AuList ret; - ret.resize(uCount); - this->Read(ret); - return ret; - } - - AuList RandomDevice::NextArrayU32(AuUInt32 uCount) - { - AuList ret; - ret.resize(uCount); - this->Read(ret); - return ret; - } - AuUInt64 RandomDevice::NextU64Range(AuUInt64 uMin, AuUInt64 uMax) { auto uRange = uMax - uMin; @@ -498,58 +322,6 @@ namespace Aurora::RNG return iMin + uNext; } - AuList RandomDevice::NextArrayI64RangeFast(AuUInt32 uCount, AuInt64 iMin, AuInt64 iMax) - { - AuList ret; - - ret.resize(uCount); - - auto uRange = AuUInt64(iMax - iMin); - auto uUpperBound = AuRoundUpPow2(uRange + 1); - auto uSeed = this->NextU64(); - - for (AU_ITERATE_N(uIndex, uCount)) - { - AuUInt64 uNext {}; - - uSeed = AuFnv1a64Runtime(&uSeed); - while ((uNext = (uSeed & (uUpperBound - 1))) > uRange) - { - uSeed = AuFnv1a64Runtime(&uSeed); - } - - ret[uIndex] = iMin + uNext; - } - - return ret; - } - - AuList RandomDevice::NextArrayU64RangeFast(AuUInt32 uCount, AuUInt64 uMin, AuUInt64 uMax) - { - AuList ret; - - ret.resize(uCount); - - auto uRange = uMax - uMin; - auto uUpperBound = AuRoundUpPow2(uRange + 1); - auto uSeed = this->NextU64(); - - for (AU_ITERATE_N(uIndex, uCount)) - { - AuUInt64 uNext {}; - - uSeed = AuFnv1a64Runtime(&uSeed); - while ((uNext = (uSeed & (uUpperBound - 1))) > uRange) - { - uSeed = AuFnv1a64Runtime(&uSeed); - } - - ret[uIndex] = uMin + uNext; - } - - return ret; - } - AuVec2 RandomDevice::NextVec2(AuVec2 boundA, AuVec2 boundB) { AuVec2 mins, maxs; @@ -643,407 +415,9 @@ namespace Aurora::RNG }; } - AuList RandomDevice::NextArrayI64Range(AuUInt32 uCount, AuInt64 iMin, AuInt64 iMax) - { - AuList ret; - AuList rngBytes; - - ret.resize(uCount); - rngBytes.resize(uCount); - this->Read(rngBytes); - - auto uRange = AuUInt64(iMax - iMin); - auto uUpperBound = AuRoundUpPow2(uRange + 1); - - for (AU_ITERATE_N(uIndex, rngBytes.size())) - { - auto uMassiveWord = rngBytes[uIndex]; - AuUInt64 uNext {}; - while ((uNext = (uMassiveWord & (uUpperBound - 1))) > uRange) - { - uMassiveWord = AuFnv1a64Runtime(&uMassiveWord); - } - - ret[uIndex] = iMin + uRange; - } - - return ret; - } - - AuList RandomDevice::NextArrayU64Range(AuUInt32 uCount, AuUInt64 uMin, AuUInt64 uMax) - { - AuList ret; - AuList rngBytes; - - ret.resize(uCount); - rngBytes.resize(uCount); - this->Read(rngBytes); - - auto uRange = uMax - uMin; - auto uUpperBound = AuRoundUpPow2(uRange + 1); - - for (AU_ITERATE_N(uIndex, rngBytes.size())) - { - auto uMassiveWord = rngBytes[uIndex]; - AuUInt64 uNext {}; - while ((uNext = (uMassiveWord & (uUpperBound - 1))) > uRange) - { - uMassiveWord = AuFnv1a64Runtime(&uMassiveWord); - } - - ret[uIndex] = uMin + uNext; - } - - return ret; - } - - AuList RandomDevice::NextArrayU32Mask(AuUInt32 uCount, AuUInt32 uMask) - { - AuList ret; - ret.resize(uCount); - this->Read(ret); - for (auto &word : ret) - { - word &= uMask; - } - return ret; - } - - AuList RandomDevice::NextArrayU64Mask(AuUInt32 uCount, AuUInt64 uMask) - { - AuList ret; - ret.resize(uCount); - this->Read(ret); - for (auto &word : ret) - { - word &= uMask; - } - return ret; - } - - AuList RandomDevice::NextArrayI64(AuUInt32 uCount) - { - AuList ret; - ret.resize(uCount); - this->Read(ret); - return ret; - } - - AuList RandomDevice::NextArrayU64(AuUInt32 uCount) - { - AuList ret; - ret.resize(uCount); - this->Read(ret); - return ret; - } - - AuList RandomDevice::NextArrayVec2(AuUInt32 uCount, AuVec2 boundA, AuVec2 boundB) - { - AuVec2 mins, maxs; - mins[0] = AuMin(boundA[0], boundB[0]); - mins[1] = AuMin(boundA[1], boundB[1]); - maxs[0] = AuMax(boundA[0], boundB[0]); - maxs[1] = AuMax(boundA[1], boundB[1]); - return NextArrayVec2Sorted(uCount, mins, maxs); - } - - AuList RandomDevice::NextArrayVec2Fast(AuUInt32 uCount, AuVec2 boundA, AuVec2 boundB) - { - AuVec2 mins, maxs; - mins[0] = AuMin(boundA[0], boundB[0]); - mins[1] = AuMin(boundA[1], boundB[1]); - maxs[0] = AuMax(boundA[0], boundB[0]); - maxs[1] = AuMax(boundA[1], boundB[1]); - return NextArrayVec2SortedFast(uCount, mins, maxs); - } - - AuList RandomDevice::NextArrayVec2Sorted(AuUInt32 uCount, AuVec2 min, AuVec2 max) - { - AuVec2 range; - AuList ret; - AuList rngBytes; - - ret.resize(uCount); - rngBytes.resize(uCount); - this->Read(rngBytes); - - range[0] = max[0] - min[0]; - range[1] = max[1] - min[1]; - - for (AU_ITERATE_N(uIndex, rngBytes.size())) - { - auto uSeed = rngBytes[uIndex]; - auto dComponentA = RngConvertToDecimal(uSeed); - auto dComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); - - ret[uIndex] = AuVec2 { - (dComponentA * range[0]) + min[0], - (dComponentB * range[1]) + min[1] - }; - } - - return ret; - } - - AuList RandomDevice::NextArrayVec2SortedFast(AuUInt32 uCount, AuVec2 min, AuVec2 max) - { - AuVec2 range; - AuList ret; - - ret.resize(uCount); - - range[0] = max[0] - min[0]; - range[1] = max[1] - min[1]; - - AuUInt64 uSeed = this->NextU64(); - - for (AU_ITERATE_N(uIndex, uCount)) - { - auto dComponentA = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); - auto dComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); - - ret[uIndex] = AuVec2 { - (dComponentA * range[0]) + min[0], - (dComponentB * range[1]) + min[1] - }; - } - - return ret; - } - - AuList RandomDevice::NextArrayVec3(AuUInt32 uCount, AuVec3 boundA, AuVec3 boundB) - { - AuVec3 mins, maxs; - mins[0] = AuMin(boundA[0], boundB[0]); - mins[1] = AuMin(boundA[1], boundB[1]); - mins[2] = AuMin(boundA[2], boundB[2]); - maxs[0] = AuMax(boundA[0], boundB[0]); - maxs[1] = AuMax(boundA[1], boundB[1]); - maxs[2] = AuMax(boundA[2], boundB[2]); - return NextArrayVec3Sorted(uCount, mins, maxs); - } - - AuList RandomDevice::NextArrayVec3Fast(AuUInt32 uCount, AuVec3 boundA, AuVec3 boundB) - { - AuVec3 mins, maxs; - mins[0] = AuMin(boundA[0], boundB[0]); - mins[1] = AuMin(boundA[1], boundB[1]); - mins[2] = AuMin(boundA[2], boundB[2]); - maxs[0] = AuMax(boundA[0], boundB[0]); - maxs[1] = AuMax(boundA[1], boundB[1]); - maxs[2] = AuMax(boundA[2], boundB[2]); - return NextArrayVec3SortedFast(uCount, mins, maxs); - } - - AuList RandomDevice::NextArrayVec3Sorted(AuUInt32 uCount, AuVec3 min, AuVec3 max) - { - AuVec3 range; - AuList ret; - AuList rngBytes; - - ret.resize(uCount); - rngBytes.resize(uCount); - this->Read(rngBytes); - - range[0] = max[0] - min[0]; - range[1] = max[1] - min[1]; - range[2] = max[2] - min[2]; - - for (AU_ITERATE_N(uIndex, rngBytes.size())) - { - auto uSeed = rngBytes[uIndex]; - auto dComponentA = RngConvertToDecimal(uSeed); - auto dComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); - auto dComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); - - ret[uIndex] = AuVec3 { - (dComponentA * range[0]) + min[0], - (dComponentB * range[1]) + min[1], - (dComponentC * range[2]) + min[2] - }; - } - - return ret; - } - - AuList RandomDevice::NextArrayVec3SortedFast(AuUInt32 uCount, AuVec3 min, AuVec3 max) - { - AuVec3 range; - AuList ret; - - ret.resize(uCount); - - range[0] = max[0] - min[0]; - range[1] = max[1] - min[1]; - range[2] = max[2] - min[2]; - - AuUInt64 uSeed = this->NextU64(); - - for (AU_ITERATE_N(uIndex, uCount)) - { - auto dComponentA = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); - auto dComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); - auto dComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); - - ret[uIndex] = AuVec3 { - (dComponentA * range[0]) + min[0], - (dComponentB * range[1]) + min[1], - (dComponentC * range[2]) + min[2] - }; - } - - return ret; - } - - AuList RandomDevice::NextArrayVec4(AuUInt32 uCount, AuVec4 boundA, AuVec4 boundB) - { - AuVec4 mins, maxs; - mins[0] = AuMin(boundA[0], boundB[0]); - mins[1] = AuMin(boundA[1], boundB[1]); - mins[2] = AuMin(boundA[2], boundB[2]); - mins[3] = AuMin(boundA[3], boundB[3]); - maxs[0] = AuMax(boundA[0], boundB[0]); - maxs[1] = AuMax(boundA[1], boundB[1]); - maxs[2] = AuMax(boundA[2], boundB[2]); - maxs[3] = AuMax(boundA[3], boundB[3]); - return NextArrayVec4Sorted(uCount, mins, maxs); - } - - AuList RandomDevice::NextArrayVec4Fast(AuUInt32 uCount, AuVec4 boundA, AuVec4 boundB) - { - AuVec4 mins, maxs; - mins[0] = AuMin(boundA[0], boundB[0]); - mins[1] = AuMin(boundA[1], boundB[1]); - mins[2] = AuMin(boundA[2], boundB[2]); - mins[3] = AuMin(boundA[3], boundB[3]); - maxs[0] = AuMax(boundA[0], boundB[0]); - maxs[1] = AuMax(boundA[1], boundB[1]); - maxs[2] = AuMax(boundA[2], boundB[2]); - maxs[3] = AuMax(boundA[3], boundB[3]); - return NextArrayVec4SortedFast(uCount, mins, maxs); - } - - AuList RandomDevice::NextArrayVec4Sorted(AuUInt32 uCount, AuVec4 min, AuVec4 max) - { - AuVec4 range; - AuList ret; - AuList rngBytes; - - ret.resize(uCount); - rngBytes.resize(uCount); - this->Read(rngBytes); - - range[0] = max[0] - min[0]; - range[1] = max[1] - min[1]; - range[2] = max[2] - min[2]; - range[3] = max[3] - min[3]; - - for (AU_ITERATE_N(uIndex, rngBytes.size())) - { - auto uSeed = rngBytes[uIndex]; - auto dComponentA = RngConvertToDecimal(uSeed); - auto dComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); - auto dComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); - auto dComponentD = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); - - ret[uIndex] = AuVec4 { - (dComponentA * range[0]) + min[0], - (dComponentB * range[1]) + min[1], - (dComponentC * range[2]) + min[2], - (dComponentD * range[3]) + min[3] - }; - } - - return ret; - } - - AuList RandomDevice::NextArrayVec4SortedFast(AuUInt32 uCount, AuVec4 min, AuVec4 max) - { - AuVec4 range; - AuList ret; - - ret.resize(uCount); - - range[0] = max[0] - min[0]; - range[1] = max[1] - min[1]; - range[2] = max[2] - min[2]; - range[3] = max[3] - min[3]; - - AuUInt64 uSeed = this->NextU64(); - - for (AU_ITERATE_N(uIndex, uCount)) - { - auto dComponentA = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); - auto dComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); - auto dComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); - auto dComponentD = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); - - ret[uIndex] = AuVec4 { - (dComponentA * range[0]) + min[0], - (dComponentB * range[1]) + min[1], - (dComponentC * range[2]) + min[2], - (dComponentD * range[3]) + min[3] - }; - } - - return ret; - } - - AuList RandomDevice::NextArrayDouble(AuUInt32 uCount) - { - AuList ret; - ret.resize(uCount); - this->Read(ret); - return ret; - } - - AuList RandomDevice::NextArrayDecimals(AuUInt32 uCount) - { - #if defined(AURNG_USE_FAST_DECIMALS) - AuList ret; - AuList rngBytes; - - ret.resize(uCount); - rngBytes.resize(uCount); - this->Read(rngBytes); - - for (AU_ITERATE_N(uIndex, rngBytes.size())) - { - ret[uIndex] = RngConvertToDecimal(rngBytes[uIndex]); - } - - return ret; - #else - AuList ret; - ret.resize(uCount); - - for (AU_ITERATE_N(uIndex, uCount)) - { - ret[uIndex] = this->NextDecimal(); - } - - return ret; - #endif - } - - AuList RandomDevice::NextArrayDecimalsFast(AuUInt32 uCount) - { - AuList ret; - - ret.resize(uCount); - - AuUInt64 uSeed = this->NextU64(); - for (AU_ITERATE_N(uIndex, uCount)) - { - ret[uIndex] = RngConvertToDecimal(uSeed); - uSeed = AuFnv1a64Runtime<8>(&uSeed); - } - - return ret; - } - - double RandomDevice::NextDecimal() + double RandomDevice::NextDecimal() { + // fast decimals are the default #if defined(AURNG_USE_FAST_DECIMALS) return RngConvertToDecimal(this->NextU64()); #elif defined(AURNG_USE_UNIFORM_DECIMALS) @@ -1078,31 +452,6 @@ namespace Aurora::RNG #endif } - AuList RandomDevice::NextArrayUUIDs(AuUInt32 uCount) - { - AuList ret; - AuList rngBytes; - - ret.resize(uCount); - rngBytes.resize(uCount * 16); - this->Read(rngBytes); - - for (AU_ITERATE_N(uIndex, uCount)) - { - auto pBytes = rngBytes.data() + (uIndex * 16); - - pBytes[8] &= 0xBF; - pBytes[8] |= 0x80; - - pBytes[6] &= 0x4F; - pBytes[6] |= 0x40; - - ret[uIndex] = uuids::uuid { pBytes, pBytes + 16 }; - } - - return ret; - } - uuids::uuid RandomDevice::NextUUID() { AuUInt8 bytes[16]; @@ -1117,6 +466,966 @@ namespace Aurora::RNG return uuids::uuid { bytes, bytes + 16 }; } + AuUInt RandomDevice::NextArrayI32RangeInView(AuMemoryViewWrite write, AuInt32 iMin, AuInt32 iMax) + { + AuList rngBytes; + + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + rngBytes.resize(uCount); + this->Read(rngBytes); + + auto uRange = AuUInt32(iMax - iMin); + auto uUpperBound = AuRoundUpPow2(uRange + 1); + for (AU_ITERATE_N(uIndex, rngBytes.size())) + { + auto uMassiveWord = rngBytes[uIndex]; + AuUInt32 uNext {}; + while ((uNext = (uMassiveWord & (uUpperBound - 1))) > uRange) + { + uMassiveWord = AuFnv1a32Runtime(&uMassiveWord); + } + + ret[uIndex] = iMin + uNext; + } + + return uCount; + } + + AuUInt RandomDevice::NextArrayI32RangeFastInView(AuMemoryViewWrite write, AuInt32 iMin, AuInt32 iMax) + { + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + auto uRange = AuUInt32(iMax - iMin); + auto uUpperBound = AuRoundUpPow2(uRange + 1); + auto uSeed = this->NextU32(); + + for (AU_ITERATE_N(uIndex, uCount)) + { + AuUInt32 uNext {}; + + uSeed = AuFnv1a32Runtime(&uSeed); + while ((uNext = (uSeed & (uUpperBound - 1))) > uRange) + { + uSeed = AuFnv1a32Runtime(&uSeed); + } + + ret[uIndex] = iMin + uNext; + } + + return uCount; + } + + AuUInt RandomDevice::NextArrayU32RangeInView(AuMemoryViewWrite write, AuUInt32 uMin, AuUInt32 uMax) + { + AuList rngBytes; + + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + rngBytes.resize(uCount); + this->Read(rngBytes); + + auto uRange = uMax - uMin; + auto uUpperBound = AuRoundUpPow2(uRange + 1); + + for (AU_ITERATE_N(uIndex, rngBytes.size())) + { + auto uMassiveWord = rngBytes[uIndex]; + AuUInt32 uNext {}; + while ((uNext = (uMassiveWord & (uUpperBound - 1))) > uRange) + { + uMassiveWord = AuFnv1a32Runtime(&uMassiveWord); + } + + ret[uIndex] = uMin + uNext; + } + + return uCount; + } + + AuUInt RandomDevice::NextArrayU32RangeFastInView(AuMemoryViewWrite write, AuUInt32 uMin, AuUInt32 uMax) + { + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + auto uRange = uMax - uMin; + auto uUpperBound = AuRoundUpPow2(uRange + 1); + auto uSeed = this->NextU32(); + + for (AU_ITERATE_N(uIndex, uCount)) + { + AuUInt32 uNext {}; + + uSeed = AuFnv1a32Runtime(&uSeed); + while ((uNext = (uSeed & (uUpperBound - 1))) > uRange) + { + uSeed = AuFnv1a32Runtime(&uSeed); + } + + ret[uIndex] = uMin + uNext; + } + + return uCount; + } + + AuUInt RandomDevice::NextArrayDoubleRangeInView(AuMemoryViewWrite write, double dMin, double dMax) + { + #if defined(AURNG_USE_FAST_DECIMALS) + + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + double dRange = dMax - dMin; + + if constexpr (sizeof(double) == sizeof(AuUInt64)) + { + this->Read(write); + + for (AU_ITERATE_N(uIndex, uCount)) + { + double dValue = RngConvertToDecimal(*(AuUInt64 *)&ret[uIndex]); + dValue *= dRange; + dValue += dMin; + ret[uIndex] = dValue; + } + } + else + { + AuList rngBytes; + + rngBytes.resize(uCount); + this->Read(rngBytes); + + for (AU_ITERATE_N(uIndex, rngBytes.size())) + { + double dValue = RngConvertToDecimal(rngBytes[uIndex]); + dValue *= dRange; + dValue += dMin; + ret[uIndex] = dValue; + } + } + + return uCount; + #else + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + for (AU_ITERATE_N(uIndex, uCount)) + { + ret[uIndex] = this->NextNumber(dMin, dMax); + } + + return uCount; + #endif + } + + AuUInt RandomDevice::NextArrayDoubleRangeFastInView(AuMemoryViewWrite write, double dMin, double dMax) + { + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + AuUInt64 uSeed = this->NextU64(); + double dRange = dMax - dMin; + + for (AU_ITERATE_N(uIndex, uCount)) + { + double dValue = RngConvertToDecimal(uSeed); + dValue *= dRange; + dValue += dMin; + ret[uIndex] = dValue; + uSeed = AuFnv1a64Runtime<8>(&uSeed); + } + + return uCount; + } + + AuUInt RandomDevice::NextArrayI32InView(AuMemoryViewWrite write) + { + auto ret = write.Begin(); + auto uCount = write.ToCount(); + this->Read(write); + return uCount; + } + + AuUInt RandomDevice::NextArrayU32InView(AuMemoryViewWrite write) + { + auto ret = write.Begin(); + auto uCount = write.ToCount(); + this->Read(write); + return uCount; + } + + AuUInt RandomDevice::NextArrayI64RangeFastInView(AuMemoryViewWrite write, AuInt64 iMin, AuInt64 iMax) + { + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + auto uRange = AuUInt64(iMax - iMin); + auto uUpperBound = AuRoundUpPow2(uRange + 1); + auto uSeed = this->NextU64(); + + for (AU_ITERATE_N(uIndex, uCount)) + { + AuUInt64 uNext {}; + + uSeed = AuFnv1a64Runtime(&uSeed); + while ((uNext = (uSeed & (uUpperBound - 1))) > uRange) + { + uSeed = AuFnv1a64Runtime(&uSeed); + } + + ret[uIndex] = iMin + uNext; + } + + return uCount; + } + + AuUInt RandomDevice::NextArrayU64RangeFastInView(AuMemoryViewWrite write, AuUInt64 uMin, AuUInt64 uMax) + { + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + auto uRange = uMax - uMin; + auto uUpperBound = AuRoundUpPow2(uRange + 1); + auto uSeed = this->NextU64(); + + for (AU_ITERATE_N(uIndex, uCount)) + { + AuUInt64 uNext {}; + + uSeed = AuFnv1a64Runtime(&uSeed); + while ((uNext = (uSeed & (uUpperBound - 1))) > uRange) + { + uSeed = AuFnv1a64Runtime(&uSeed); + } + + ret[uIndex] = uMin + uNext; + } + + return uCount; + } + + AuUInt RandomDevice::NextArrayI64RangeInView(AuMemoryViewWrite write, AuInt64 iMin, AuInt64 iMax) + { + AuList rngBytes; + + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + rngBytes.resize(uCount); + this->Read(rngBytes); + + auto uRange = AuUInt64(iMax - iMin); + auto uUpperBound = AuRoundUpPow2(uRange + 1); + + for (AU_ITERATE_N(uIndex, rngBytes.size())) + { + auto uMassiveWord = rngBytes[uIndex]; + AuUInt64 uNext {}; + while ((uNext = (uMassiveWord & (uUpperBound - 1))) > uRange) + { + uMassiveWord = AuFnv1a64Runtime(&uMassiveWord); + } + + ret[uIndex] = iMin + uRange; + } + + return uCount; + } + + AuUInt RandomDevice::NextArrayU64RangeInView(AuMemoryViewWrite write, AuUInt64 uMin, AuUInt64 uMax) + { + AuList rngBytes; + + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + rngBytes.resize(uCount); + this->Read(rngBytes); + + auto uRange = uMax - uMin; + auto uUpperBound = AuRoundUpPow2(uRange + 1); + + for (AU_ITERATE_N(uIndex, rngBytes.size())) + { + auto uMassiveWord = rngBytes[uIndex]; + AuUInt64 uNext {}; + while ((uNext = (uMassiveWord & (uUpperBound - 1))) > uRange) + { + uMassiveWord = AuFnv1a64Runtime(&uMassiveWord); + } + + ret[uIndex] = uMin + uNext; + } + + return uCount; + } + + AuUInt RandomDevice::NextArrayU32MaskInView(AuMemoryViewWrite write, AuUInt32 uMask) + { + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + this->Read(write); + + for (AU_ITERATE_N(i, uCount)) + { + auto &word = ret[i]; + word &= uMask; + } + return uCount; + } + + AuUInt RandomDevice::NextArrayU64MaskInView(AuMemoryViewWrite write, AuUInt64 uMask) + { + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + this->Read(write); + + for (AU_ITERATE_N(i, uCount)) + { + auto &word = ret[i]; + word &= uMask; + } + return uCount; + } + + AuUInt RandomDevice::NextArrayI64InView(AuMemoryViewWrite write) + { + auto uCount = write.ToCount(); + this->Read(write); + return uCount; + } + + AuUInt RandomDevice::NextArrayU64InView(AuMemoryViewWrite write) + { + auto uCount = write.ToCount(); + this->Read(write); + return uCount; + } + + AuUInt RandomDevice::NextArrayVec2InView(AuMemoryViewWrite write, AuVec2 boundA, AuVec2 boundB) + { + AuVec2 mins, maxs; + mins[0] = AuMin(boundA[0], boundB[0]); + mins[1] = AuMin(boundA[1], boundB[1]); + maxs[0] = AuMax(boundA[0], boundB[0]); + maxs[1] = AuMax(boundA[1], boundB[1]); + return NextArrayVec2SortedInView(write, mins, maxs); + } + + AuUInt RandomDevice::NextArrayVec2FastInView(AuMemoryViewWrite write, AuVec2 boundA, AuVec2 boundB) + { + AuVec2 mins, maxs; + mins[0] = AuMin(boundA[0], boundB[0]); + mins[1] = AuMin(boundA[1], boundB[1]); + maxs[0] = AuMax(boundA[0], boundB[0]); + maxs[1] = AuMax(boundA[1], boundB[1]); + return NextArrayVec2SortedFastInView(write, mins, maxs); + } + + AuUInt RandomDevice::NextArrayVec2SortedInView(AuMemoryViewWrite write, AuVec2 min, AuVec2 max) + { + AuVec2 range; + AuList rngBytes; + + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + rngBytes.resize(uCount); + this->Read(rngBytes); + + range[0] = max[0] - min[0]; + range[1] = max[1] - min[1]; + + for (AU_ITERATE_N(uIndex, rngBytes.size())) + { + auto uSeed = rngBytes[uIndex]; + auto dComponentA = RngConvertToDecimal(uSeed); + auto dComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); + + ret[uIndex] = AuVec2 { + (dComponentA * range[0]) + min[0], + (dComponentB * range[1]) + min[1] + }; + } + + return uCount; + } + + AuUInt RandomDevice::NextArrayVec2SortedFastInView(AuMemoryViewWrite write, AuVec2 min, AuVec2 max) + { + AuVec2 range; + + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + range[0] = max[0] - min[0]; + range[1] = max[1] - min[1]; + + AuUInt64 uSeed = this->NextU64(); + + for (AU_ITERATE_N(uIndex, uCount)) + { + auto dComponentA = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); + auto dComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); + + ret[uIndex] = AuVec2 { + (dComponentA * range[0]) + min[0], + (dComponentB * range[1]) + min[1] + }; + } + + return uCount; + } + + AuUInt RandomDevice::NextArrayVec3InView(AuMemoryViewWrite write, AuVec3 boundA, AuVec3 boundB) + { + AuVec3 mins, maxs; + mins[0] = AuMin(boundA[0], boundB[0]); + mins[1] = AuMin(boundA[1], boundB[1]); + mins[2] = AuMin(boundA[2], boundB[2]); + maxs[0] = AuMax(boundA[0], boundB[0]); + maxs[1] = AuMax(boundA[1], boundB[1]); + maxs[2] = AuMax(boundA[2], boundB[2]); + return NextArrayVec3SortedInView(write, mins, maxs); + } + + AuUInt RandomDevice::NextArrayVec3FastInView(AuMemoryViewWrite write, AuVec3 boundA, AuVec3 boundB) + { + AuVec3 mins, maxs; + mins[0] = AuMin(boundA[0], boundB[0]); + mins[1] = AuMin(boundA[1], boundB[1]); + mins[2] = AuMin(boundA[2], boundB[2]); + maxs[0] = AuMax(boundA[0], boundB[0]); + maxs[1] = AuMax(boundA[1], boundB[1]); + maxs[2] = AuMax(boundA[2], boundB[2]); + return NextArrayVec3SortedFastInView(write, mins, maxs); + } + + AuUInt RandomDevice::NextArrayVec3SortedInView(AuMemoryViewWrite write, AuVec3 min, AuVec3 max) + { + AuVec3 range; + AuList rngBytes; + + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + rngBytes.resize(uCount); + this->Read(rngBytes); + + range[0] = max[0] - min[0]; + range[1] = max[1] - min[1]; + range[2] = max[2] - min[2]; + + for (AU_ITERATE_N(uIndex, rngBytes.size())) + { + auto uSeed = rngBytes[uIndex]; + auto dComponentA = RngConvertToDecimal(uSeed); + auto dComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); + auto dComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); + + ret[uIndex] = AuVec3 { + (dComponentA * range[0]) + min[0], + (dComponentB * range[1]) + min[1], + (dComponentC * range[2]) + min[2] + }; + } + + return uCount; + } + + AuUInt RandomDevice::NextArrayVec3SortedFastInView(AuMemoryViewWrite write, AuVec3 min, AuVec3 max) + { + AuVec3 range; + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + range[0] = max[0] - min[0]; + range[1] = max[1] - min[1]; + range[2] = max[2] - min[2]; + + AuUInt64 uSeed = this->NextU64(); + + for (AU_ITERATE_N(uIndex, uCount)) + { + auto dComponentA = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); + auto dComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); + auto dComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); + + ret[uIndex] = AuVec3 { + (dComponentA * range[0]) + min[0], + (dComponentB * range[1]) + min[1], + (dComponentC * range[2]) + min[2] + }; + } + + return uCount; + } + + AuUInt RandomDevice::NextArrayVec4InView(AuMemoryViewWrite write, AuVec4 boundA, AuVec4 boundB) + { + AuVec4 mins, maxs; + mins[0] = AuMin(boundA[0], boundB[0]); + mins[1] = AuMin(boundA[1], boundB[1]); + mins[2] = AuMin(boundA[2], boundB[2]); + mins[3] = AuMin(boundA[3], boundB[3]); + maxs[0] = AuMax(boundA[0], boundB[0]); + maxs[1] = AuMax(boundA[1], boundB[1]); + maxs[2] = AuMax(boundA[2], boundB[2]); + maxs[3] = AuMax(boundA[3], boundB[3]); + return NextArrayVec4SortedInView(write, mins, maxs); + } + + AuUInt RandomDevice::NextArrayVec4FastInView(AuMemoryViewWrite write, AuVec4 boundA, AuVec4 boundB) + { + AuVec4 mins, maxs; + mins[0] = AuMin(boundA[0], boundB[0]); + mins[1] = AuMin(boundA[1], boundB[1]); + mins[2] = AuMin(boundA[2], boundB[2]); + mins[3] = AuMin(boundA[3], boundB[3]); + maxs[0] = AuMax(boundA[0], boundB[0]); + maxs[1] = AuMax(boundA[1], boundB[1]); + maxs[2] = AuMax(boundA[2], boundB[2]); + maxs[3] = AuMax(boundA[3], boundB[3]); + return NextArrayVec4SortedFastInView(write, mins, maxs); + } + + AuUInt RandomDevice::NextArrayVec4SortedInView(AuMemoryViewWrite write, AuVec4 min, AuVec4 max) + { + AuVec4 range; + AuList rngBytes; + + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + rngBytes.resize(uCount); + this->Read(rngBytes); + + range[0] = max[0] - min[0]; + range[1] = max[1] - min[1]; + range[2] = max[2] - min[2]; + range[3] = max[3] - min[3]; + + for (AU_ITERATE_N(uIndex, rngBytes.size())) + { + auto uSeed = rngBytes[uIndex]; + auto dComponentA = RngConvertToDecimal(uSeed); + auto dComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); + auto dComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); + auto dComponentD = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); + + ret[uIndex] = AuVec4 { + (dComponentA * range[0]) + min[0], + (dComponentB * range[1]) + min[1], + (dComponentC * range[2]) + min[2], + (dComponentD * range[3]) + min[3] + }; + } + + return uCount; + } + + AuUInt RandomDevice::NextArrayVec4SortedFastInView(AuMemoryViewWrite write, AuVec4 min, AuVec4 max) + { + AuVec4 range; + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + range[0] = max[0] - min[0]; + range[1] = max[1] - min[1]; + range[2] = max[2] - min[2]; + range[3] = max[3] - min[3]; + + AuUInt64 uSeed = this->NextU64(); + + for (AU_ITERATE_N(uIndex, uCount)) + { + auto dComponentA = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); + auto dComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); + auto dComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); + auto dComponentD = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime<8>(&uSeed))); + + ret[uIndex] = AuVec4 { + (dComponentA * range[0]) + min[0], + (dComponentB * range[1]) + min[1], + (dComponentC * range[2]) + min[2], + (dComponentD * range[3]) + min[3] + }; + } + + return uCount; + } + + AuUInt RandomDevice::NextArrayDoubleInView(AuMemoryViewWrite write) + { + auto ret = write.Begin(); + auto uCount = write.ToCount(); + this->Read(write); + return uCount; + } + + AuUInt RandomDevice::NextArrayDecimalsInView(AuMemoryViewWrite write) + { + #if defined(AURNG_USE_FAST_DECIMALS) + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + if constexpr (sizeof(double) == sizeof(AuUInt64)) + { + this->Read(write); + + for (AU_ITERATE_N(uIndex, uCount)) + { + ret[uIndex] = RngConvertToDecimal(*(AuUInt64*)&ret[uIndex]); + } + } + else + { + AuList rngBytes; + + rngBytes.resize(uCount); + this->Read(rngBytes); + + for (AU_ITERATE_N(uIndex, rngBytes.size())) + { + ret[uIndex] = RngConvertToDecimal(rngBytes[uIndex]); + } + } + + return uCount; + #else + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + for (AU_ITERATE_N(uIndex, uCount)) + { + ret[uIndex] = this->NextDecimal(); + } + + return uCount; + #endif + } + + AuUInt RandomDevice::NextArrayDecimalsFastInView(AuMemoryViewWrite write) + { + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + AuUInt64 uSeed = this->NextU64(); + for (AU_ITERATE_N(uIndex, uCount)) + { + ret[uIndex] = RngConvertToDecimal(uSeed); + uSeed = AuFnv1a64Runtime<8>(&uSeed); + } + + return uCount; + } + + AuUInt RandomDevice::NextArrayUUIDsInView(AuMemoryViewWrite write) + { + auto ret = write.Begin(); + auto uCount = write.ToCount(); + + if constexpr (sizeof(uuids::uuid) == 16) + { + this->Read(write); + + for (AU_ITERATE_N(uIndex, uCount)) + { + auto pBytes = write.Begin() + (uIndex * 16); + + pBytes[8] &= 0xBF; + pBytes[8] |= 0x80; + + pBytes[6] &= 0x4F; + pBytes[6] |= 0x40; + } + } + else + { + AuList rngBytes; + + rngBytes.resize(uCount * 16); + this->Read(rngBytes); + + for (AU_ITERATE_N(uIndex, uCount)) + { + auto pBytes = rngBytes.data() + (uIndex * 16); + + pBytes[8] &= 0xBF; + pBytes[8] |= 0x80; + + pBytes[6] &= 0x4F; + pBytes[6] |= 0x40; + + ret[uIndex] = uuids::uuid { pBytes, pBytes + 16 }; + } + } + + return uCount; + } + + AuList RandomDevice::NextArrayI32Range(AuUInt32 uCount, AuInt32 iMin, AuInt32 iMax) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayI32RangeInView(ret, iMin, iMax); + return ret; + } + + AuList RandomDevice::NextArrayI32RangeFast(AuUInt32 uCount, AuInt32 iMin, AuInt32 iMax) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayI32RangeFastInView(ret, iMin, iMax); + return ret; + } + + AuList RandomDevice::NextArrayU32Range(AuUInt32 uCount, AuUInt32 uMin, AuUInt32 uMax) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayU32RangeInView(ret, uMin, uMax); + return ret; + } + + AuList RandomDevice::NextArrayU32RangeFast(AuUInt32 uCount, AuUInt32 uMin, AuUInt32 uMax) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayU32RangeFastInView(ret, uMin, uMax); + return ret; + } + + AuList RandomDevice::NextArrayDoubleRange(AuUInt32 uCount, double dMin, double dMax) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayDoubleRangeInView(ret, dMin, dMax); + return ret; + } + + AuList RandomDevice::NextArrayDoubleRangeFast(AuUInt32 uCount, double dMin, double dMax) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayDoubleRangeFastInView(ret, dMin, dMax); + return ret; + } + + AuList RandomDevice::NextArrayI32(AuUInt32 uCount) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayI32InView(ret); + return ret; + } + + AuList RandomDevice::NextArrayU32(AuUInt32 uCount) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayU32InView(ret); + return ret; + } + + AuList RandomDevice::NextArrayI64RangeFast(AuUInt32 uCount, AuInt64 iMin, AuInt64 iMax) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayI64RangeFastInView(ret, iMin, iMax); + return ret; + } + + AuList RandomDevice::NextArrayU64RangeFast(AuUInt32 uCount, AuUInt64 uMin, AuUInt64 uMax) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayU64RangeFastInView(ret, uMin, uMax); + return ret; + } + + AuList RandomDevice::NextArrayI64Range(AuUInt32 uCount, AuInt64 iMin, AuInt64 iMax) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayI64RangeInView(ret, iMin, iMax); + return ret; + } + + AuList RandomDevice::NextArrayU64Range(AuUInt32 uCount, AuUInt64 uMin, AuUInt64 uMax) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayU64RangeInView(ret, uMin, uMax); + return ret; + } + + AuList RandomDevice::NextArrayU32Mask(AuUInt32 uCount, AuUInt32 uMask) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayU32MaskInView(ret, uMask); + return ret; + } + + AuList RandomDevice::NextArrayU64Mask(AuUInt32 uCount, AuUInt64 uMask) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayU64MaskInView(ret, uMask); + return ret; + } + + AuList RandomDevice::NextArrayI64(AuUInt32 uCount) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayI64InView(ret); + return ret; + } + + AuList RandomDevice::NextArrayU64(AuUInt32 uCount) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayU64InView(ret); + return ret; + } + + AuList RandomDevice::NextArrayVec2(AuUInt32 uCount, AuVec2 boundA, AuVec2 boundB) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayVec2InView(ret, boundA, boundB); + return ret; + } + + AuList RandomDevice::NextArrayVec2Fast(AuUInt32 uCount, AuVec2 boundA, AuVec2 boundB) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayVec2FastInView(ret, boundA, boundB); + return ret; + } + + AuList RandomDevice::NextArrayVec2Sorted(AuUInt32 uCount, AuVec2 min, AuVec2 max) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayVec2SortedInView(ret, min, max); + return ret; + } + + AuList RandomDevice::NextArrayVec2SortedFast(AuUInt32 uCount, AuVec2 min, AuVec2 max) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayVec2SortedFastInView(ret, min, max); + return ret; + } + + AuList RandomDevice::NextArrayVec3(AuUInt32 uCount, AuVec3 boundA, AuVec3 boundB) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayVec3InView(ret, boundA, boundB); + return ret; + } + + AuList RandomDevice::NextArrayVec3Fast(AuUInt32 uCount, AuVec3 boundA, AuVec3 boundB) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayVec3FastInView(ret, boundA, boundB); + return ret; + } + + AuList RandomDevice::NextArrayVec3Sorted(AuUInt32 uCount, AuVec3 min, AuVec3 max) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayVec3SortedInView(ret, min, max); + return ret; + } + + AuList RandomDevice::NextArrayVec3SortedFast(AuUInt32 uCount, AuVec3 min, AuVec3 max) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayVec3SortedFastInView(ret, min, max); + return ret; + } + + AuList RandomDevice::NextArrayVec4(AuUInt32 uCount, AuVec4 boundA, AuVec4 boundB) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayVec4InView(ret, boundA, boundB); + return ret; + } + + AuList RandomDevice::NextArrayVec4Fast(AuUInt32 uCount, AuVec4 boundA, AuVec4 boundB) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayVec4FastInView(ret, boundA, boundB); + return ret; + } + + AuList RandomDevice::NextArrayVec4Sorted(AuUInt32 uCount, AuVec4 min, AuVec4 max) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayVec4SortedInView(ret, min, max); + return ret; + } + + AuList RandomDevice::NextArrayVec4SortedFast(AuUInt32 uCount, AuVec4 min, AuVec4 max) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayVec4SortedFastInView(ret, min, max); + return ret; + } + + AuList RandomDevice::NextArrayDouble(AuUInt32 uCount) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayDoubleInView(ret); + return ret; + } + + AuList RandomDevice::NextArrayDecimals(AuUInt32 uCount) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayDecimalsInView(ret); + return ret; + } + + AuList RandomDevice::NextArrayDecimalsFast(AuUInt32 uCount) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayDecimalsFastInView(ret); + return ret; + } + + AuList RandomDevice::NextArrayUUIDs(AuUInt32 uCount) + { + AuList ret; + ret.resize(uCount); + (void)NextArrayUUIDsInView(ret); + return ret; + } + AuMemoryViewRead RandomDevice::ToSeed() { if (this->def_.bSecure) diff --git a/Source/RNG/AuRandomDevice.hpp b/Source/RNG/AuRandomDevice.hpp index 7730661e..dafe42c4 100644 --- a/Source/RNG/AuRandomDevice.hpp +++ b/Source/RNG/AuRandomDevice.hpp @@ -69,6 +69,38 @@ namespace Aurora::RNG 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; + 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; + AuUInt NextArrayDoubleInView(Memory::MemoryViewWrite write) override; + AuUInt NextArrayDecimalsInView(Memory::MemoryViewWrite write) override; + AuUInt NextArrayDecimalsFastInView(Memory::MemoryViewWrite write) override; + AuUInt NextArrayUUIDsInView(Memory::MemoryViewWrite write) override; double NextDecimal() override; double NextNumber(double dMin, double dMax) override;