[+] AuRNG::IRandomDevice::NextU64Range
[+] AuRNG::IRandomDevice::NextI64Range [+] AuRNG::IRandomDevice::NextVec2 [+] AuRNG::IRandomDevice::NextVec2Sorted [+] AuRNG::IRandomDevice::NextVec3 [+] AuRNG::IRandomDevice::NextVec3Sorted [+] AuRNG::IRandomDevice::NextVec4 [+] AuRNG::IRandomDevice::NextVec4Sorted [+] AuRNG::IRandomDevice::NextArrayI64Range [+] AuRNG::IRandomDevice::NextArrayU64Range [+] AuRNG::IRandomDevice::NextArrayU32Mask [+] AuRNG::IRandomDevice::NextArrayU64Mask [+] AuRNG::IRandomDevice::NextArrayI64 [+] AuRNG::IRandomDevice::NextArrayU64 [+] AuRNG::IRandomDevice::NextArrayVec2 [+] AuRNG::IRandomDevice::NextArrayVec2Sorted [+] AuRNG::IRandomDevice::NextArrayVec3 [+] AuRNG::IRandomDevice::NextArrayVec3Sorted [+] AuRNG::IRandomDevice::NextArrayVec4 [+] AuRNG::IRandomDevice::NextArrayVec4Sorted [+] AuRNG::IRandomDevice::NextArrayVec4SortedFast [+] AuRNG::IRandomDevice::NextArrayVec3SortedFast [+] AuRNG::IRandomDevice::NextArrayVec2SortedFast [+] AuRNG::IRandomDevice::NextArrayDoubleRangeFast [+] AuRNG::IRandomDevice::NextArrayDecimalsFast [+] AuRNG::RngU64Range [+] AuRNG::RngI64Range [+] AuRNG::RngVec2 [+] AuRNG::RngVec2Sorted [+] AuRNG::RngVec3 [+] AuRNG::RngVec3Sorted [+] AuRNG::RngVec4 [+] AuRNG::RngVec4Sorted [+] AuRNG::RngArrayI64Range [+] AuRNG::RngArrayU64Range [+] AuRNG::RngArrayU32Mask [+] AuRNG::RngArrayU64Mask [+] AuRNG::RngArrayI64 [+] AuRNG::RngArrayU64 [+] AuRNG::RngArrayVec2 [+] AuRNG::RngArrayVec2Sorted [+] AuRNG::RngArrayVec3 [+] AuRNG::RngArrayVec3Sorted [+] AuRNG::RngArrayVec4 [+] AuRNG::RngArrayVec4Sorted [+] AuRNG::RngArrayVec4SortedFast [+] AuRNG::RngArrayVec3SortedFast [+] AuRNG::RngArrayVec2SortedFast [+] AuRNG::RngArrayDoubleRangeFast [+] AuRNG::RngArrayDecimalsFast
This commit is contained in:
parent
b88e28aea0
commit
5f9681c9e3
@ -21,19 +21,44 @@ namespace Aurora::RNG
|
||||
virtual bool NextBoolean() = 0;
|
||||
virtual AuUInt32 NextU32() = 0;
|
||||
virtual AuUInt32 NextU32Range(AuUInt32 uMin, AuUInt32 uMax) = 0;
|
||||
virtual AuUInt64 NextU64() = 0;
|
||||
virtual AuInt32 NextI32Range(AuInt32 iMin, AuInt32 iMax) = 0;
|
||||
virtual AuUInt64 NextU64() = 0;
|
||||
virtual AuUInt64 NextU64Range(AuUInt64 uMin, AuUInt64 uMax) = 0;
|
||||
virtual AuInt64 NextI64Range(AuInt64 iMin, AuInt64 iMax) = 0;
|
||||
virtual AuVec2 NextVec2(AuVec2 boundA, AuVec2 boundB) = 0;
|
||||
virtual AuVec2 NextVec2Sorted(AuVec2 min, AuVec2 max) = 0;
|
||||
virtual AuVec3 NextVec3(AuVec3 boundA, AuVec3 boundB) = 0;
|
||||
virtual AuVec3 NextVec3Sorted(AuVec3 min, AuVec3 max) = 0;
|
||||
virtual AuVec4 NextVec4(AuVec4 boundA, AuVec4 boundB) = 0;
|
||||
virtual AuVec4 NextVec4Sorted(AuVec4 min, AuVec4 max) = 0;
|
||||
virtual double NextDecimal() = 0;
|
||||
virtual double NextNumber(double dMin, double dMax) = 0;
|
||||
virtual AuUInt32 NextIndex(AuUInt32 uCount /* = max + 1*/) = 0;
|
||||
virtual uuids::uuid NextUUID() = 0;
|
||||
virtual AuList<AuInt32> NextArrayI32Range(AuUInt32 uCount, AuInt32 iMin, AuInt32 iMax) = 0;
|
||||
virtual AuList<AuUInt32> NextArrayU32Range(AuUInt32 uCount, AuUInt32 uMin, AuUInt32 uMax) = 0;
|
||||
virtual AuList<AuInt64> NextArrayI64Range(AuUInt32 uCount, AuInt64 iMin, AuInt64 iMax) = 0;
|
||||
virtual AuList<AuUInt64> NextArrayU64Range(AuUInt32 uCount, AuUInt64 uMin, AuUInt64 uMax) = 0;
|
||||
virtual AuList<AuUInt32> NextArrayU32Mask(AuUInt32 uCount, AuUInt32 uMask) = 0;
|
||||
virtual AuList<AuUInt64> NextArrayU64Mask(AuUInt32 uCount, AuUInt64 uMask) = 0;
|
||||
virtual AuList<double> NextArrayDoubleRange(AuUInt32 uCount, double dMin, double dMax) = 0;
|
||||
virtual AuList<double> NextArrayDoubleRangeFast(AuUInt32 uCount, double dMin, double dMax) = 0;
|
||||
virtual AuList<AuInt32> NextArrayI32(AuUInt32 uCount) = 0;
|
||||
virtual AuList<AuUInt32> NextArrayU32(AuUInt32 uCount) = 0;
|
||||
virtual AuList<AuInt64> NextArrayI64(AuUInt32 uCount) = 0;
|
||||
virtual AuList<AuUInt64> NextArrayU64(AuUInt32 uCount) = 0;
|
||||
virtual AuList<AuVec2> NextArrayVec2(AuUInt32 uCount, AuVec2 boundA, AuVec2 boundB) = 0;
|
||||
virtual AuList<AuVec2> NextArrayVec2Sorted(AuUInt32 uCount, AuVec2 min, AuVec2 max) = 0;
|
||||
virtual AuList<AuVec2> NextArrayVec2SortedFast(AuUInt32 uCount, AuVec2 min, AuVec2 max) = 0;
|
||||
virtual AuList<AuVec3> NextArrayVec3(AuUInt32 uCount, AuVec3 boundA, AuVec3 boundB) = 0;
|
||||
virtual AuList<AuVec3> NextArrayVec3Sorted(AuUInt32 uCount, AuVec3 min, AuVec3 max) = 0;
|
||||
virtual AuList<AuVec3> NextArrayVec3SortedFast(AuUInt32 uCount, AuVec3 min, AuVec3 max) = 0;
|
||||
virtual AuList<AuVec4> NextArrayVec4(AuUInt32 uCount, AuVec4 boundA, AuVec4 boundB) = 0;
|
||||
virtual AuList<AuVec4> NextArrayVec4Sorted(AuUInt32 uCount, AuVec4 min, AuVec4 max) = 0;
|
||||
virtual AuList<AuVec4> NextArrayVec4SortedFast(AuUInt32 uCount, AuVec4 min, AuVec4 max) = 0;
|
||||
virtual AuList<double> NextArrayDouble(AuUInt32 uCount) = 0;
|
||||
virtual AuList<double> NextArrayDecimals(AuUInt32 uCount) = 0;
|
||||
virtual AuList<double> NextArrayDecimalsFast(AuUInt32 uCount) = 0;
|
||||
virtual AuList<uuids::uuid> NextArrayUUIDs(AuUInt32 uCount) = 0;
|
||||
|
||||
virtual IO::IStreamReader *ToStreamReader() = 0;
|
||||
|
@ -30,19 +30,44 @@ namespace Aurora::RNG
|
||||
AUKN_SYM bool RngBoolean();
|
||||
AUKN_SYM AuUInt32 RngU32();
|
||||
AUKN_SYM AuUInt32 RngU32Range(AuUInt32 uMin, AuUInt32 uMax);
|
||||
AUKN_SYM AuUInt64 RngU64();
|
||||
AUKN_SYM AuInt32 RngI32Range(AuInt32 iMin, AuInt32 iMax);
|
||||
AUKN_SYM AuUInt64 RngU64Range(AuUInt64 uMin, AuUInt64 uMax);
|
||||
AUKN_SYM AuInt64 RngI64Range(AuInt64 iMin, AuInt64 iMax);
|
||||
AUKN_SYM AuVec2 RngVec2(AuVec2 boundA, AuVec2 boundB);
|
||||
AUKN_SYM AuVec2 RngVec2Sorted(AuVec2 min, AuVec2 max);
|
||||
AUKN_SYM AuVec3 RngVec3(AuVec3 boundA, AuVec3 boundB);
|
||||
AUKN_SYM AuVec3 RngVec3Sorted(AuVec3 min, AuVec3 max);
|
||||
AUKN_SYM AuVec4 RngVec4(AuVec4 boundA, AuVec4 boundB);
|
||||
AUKN_SYM AuVec4 RngVec4Sorted(AuVec4 min, AuVec4 max);
|
||||
AUKN_SYM AuUInt64 RngU64();
|
||||
AUKN_SYM double RngDecimal();
|
||||
AUKN_SYM double RngNumber(double dMin, double dMax);
|
||||
AUKN_SYM AuUInt32 RngIndex(AuUInt32 uCount /* = max + 1*/);
|
||||
AUKN_SYM uuids::uuid RngUUID();
|
||||
AUKN_SYM AuList<AuInt32> RngArrayI32Range(AuUInt32 uCount, AuInt32 iMin, AuInt32 iMax);
|
||||
AUKN_SYM AuList<AuUInt32> RngArrayU32Range(AuUInt32 uCount, AuUInt32 uMin, AuUInt32 uMax);
|
||||
AUKN_SYM AuList<AuInt64> RngArrayI64Range(AuUInt32 uCount, AuInt64 iMin, AuInt64 iMax);
|
||||
AUKN_SYM AuList<AuUInt64> RngArrayU64Range(AuUInt32 uCount, AuUInt64 uMin, AuUInt64 uMax);
|
||||
AUKN_SYM AuList<AuUInt32> RngArrayU32Mask(AuUInt32 uCount, AuUInt32 uMask);
|
||||
AUKN_SYM AuList<AuUInt64> RngArrayU64Mask(AuUInt32 uCount, AuUInt64 uMask);
|
||||
AUKN_SYM AuList<double> RngArrayDoubleRange(AuUInt32 uCount, double dMin, double dMax);
|
||||
AUKN_SYM AuList<double> RngArrayDoubleRangeFast(AuUInt32 uCount, double dMin, double dMax);
|
||||
AUKN_SYM AuList<AuInt32> RngArrayI32(AuUInt32 uCount);
|
||||
AUKN_SYM AuList<AuUInt32> RngArrayU32(AuUInt32 uCount);
|
||||
AUKN_SYM AuList<AuInt64> RngArrayI64(AuUInt32 uCount);
|
||||
AUKN_SYM AuList<AuUInt64> RngArrayU64(AuUInt32 uCount);
|
||||
AUKN_SYM AuList<AuVec2> RngArrayVec2(AuUInt32 uCount, AuVec2 boundA, AuVec2 boundB);
|
||||
AUKN_SYM AuList<AuVec2> RngArrayVec2Sorted(AuUInt32 uCount, AuVec2 min, AuVec2 max);
|
||||
AUKN_SYM AuList<AuVec2> RngArrayVec2SortedFast(AuUInt32 uCount, AuVec2 min, AuVec2 max);
|
||||
AUKN_SYM AuList<AuVec3> RngArrayVec3(AuUInt32 uCount, AuVec3 boundA, AuVec3 boundB);
|
||||
AUKN_SYM AuList<AuVec3> RngArrayVec3Sorted(AuUInt32 uCount, AuVec3 min, AuVec3 max);
|
||||
AUKN_SYM AuList<AuVec3> RngArrayVec3SortedFast(AuUInt32 uCount, AuVec3 min, AuVec3 max);
|
||||
AUKN_SYM AuList<AuVec4> RngArrayVec4(AuUInt32 uCount, AuVec4 boundA, AuVec4 boundB);
|
||||
AUKN_SYM AuList<AuVec4> RngArrayVec4Sorted(AuUInt32 uCount, AuVec4 min, AuVec4 max);
|
||||
AUKN_SYM AuList<AuVec4> RngArrayVec4SortedFast(AuUInt32 uCount, AuVec4 min, AuVec4 max);
|
||||
AUKN_SYM AuList<double> RngArrayDouble(AuUInt32 uCount);
|
||||
AUKN_SYM AuList<double> RngArrayDecimals(AuUInt32 uCount);
|
||||
AUKN_SYM AuList<double> RngArrayDecimalsFast(AuUInt32 uCount);
|
||||
AUKN_SYM AuList<uuids::uuid> RngArrayUUIDs(AuUInt32 uCount);
|
||||
// Note: it is conceivable that someone may want the following templates for some cryptographic purpose
|
||||
|
||||
|
@ -18,17 +18,17 @@ namespace Aurora::RNG
|
||||
return gFastDevice->NextString(dwLength, type);
|
||||
}
|
||||
|
||||
AUKN_SYM void RngString(char *pString, AuUInt32 dwLength, ERngStringCharacters type)
|
||||
AUKN_SYM void RngString(char *pString, AuUInt32 dwLength, ERngStringCharacters type)
|
||||
{
|
||||
gFastDevice->NextString(pString, dwLength, type);
|
||||
}
|
||||
|
||||
AUKN_SYM AuUInt8 RngByte()
|
||||
AUKN_SYM AuUInt8 RngByte()
|
||||
{
|
||||
return gFastDevice->NextByte();
|
||||
}
|
||||
|
||||
AUKN_SYM bool RngBoolean()
|
||||
AUKN_SYM bool RngBoolean()
|
||||
{
|
||||
return gFastDevice->NextBoolean();
|
||||
}
|
||||
@ -53,12 +53,12 @@ namespace Aurora::RNG
|
||||
return gFastDevice->NextI32Range(uMin, uMax);
|
||||
}
|
||||
|
||||
AUKN_SYM double RngDecimal()
|
||||
AUKN_SYM double RngDecimal()
|
||||
{
|
||||
return gFastDevice->NextDecimal();
|
||||
}
|
||||
|
||||
AUKN_SYM double RngNumber(double min, double max)
|
||||
AUKN_SYM double RngNumber(double min, double max)
|
||||
{
|
||||
return gFastDevice->NextNumber(min, max);
|
||||
}
|
||||
@ -73,37 +73,37 @@ namespace Aurora::RNG
|
||||
return gFastDevice->NextUUID();
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<AuInt32> RngArrayI32Range(AuUInt32 uCount, AuInt32 iMin, AuInt32 iMax)
|
||||
AUKN_SYM AuList<AuInt32> RngArrayI32Range(AuUInt32 uCount, AuInt32 iMin, AuInt32 iMax)
|
||||
{
|
||||
return gFastDevice->NextArrayI32Range(uCount, iMin, iMax);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<AuUInt32> RngArrayU32Range(AuUInt32 uCount, AuUInt32 uMin, AuUInt32 uMax)
|
||||
AUKN_SYM AuList<AuUInt32> RngArrayU32Range(AuUInt32 uCount, AuUInt32 uMin, AuUInt32 uMax)
|
||||
{
|
||||
return gFastDevice->NextArrayU32Range(uCount, uMin, uMax);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<double> RngArrayDoubleRange(AuUInt32 uCount, double dMin, double dMax)
|
||||
AUKN_SYM AuList<double> RngArrayDoubleRange(AuUInt32 uCount, double dMin, double dMax)
|
||||
{
|
||||
return gFastDevice->NextArrayDoubleRange(uCount, dMin, dMax);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<AuInt32> RngArrayI32(AuUInt32 uCount)
|
||||
AUKN_SYM AuList<AuInt32> RngArrayI32(AuUInt32 uCount)
|
||||
{
|
||||
return gFastDevice->NextArrayI32(uCount);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<AuUInt32> RngArrayU32(AuUInt32 uCount)
|
||||
AUKN_SYM AuList<AuUInt32> RngArrayU32(AuUInt32 uCount)
|
||||
{
|
||||
return gFastDevice->NextArrayU32(uCount);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<double> RngArrayDouble(AuUInt32 uCount)
|
||||
AUKN_SYM AuList<double> RngArrayDouble(AuUInt32 uCount)
|
||||
{
|
||||
return gFastDevice->NextArrayDouble(uCount);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<double> RngArrayDecimals(AuUInt32 uCount)
|
||||
AUKN_SYM AuList<double> RngArrayDecimals(AuUInt32 uCount)
|
||||
{
|
||||
return gFastDevice->NextArrayDecimals(uCount);
|
||||
}
|
||||
@ -112,4 +112,129 @@ namespace Aurora::RNG
|
||||
{
|
||||
return gFastDevice->NextArrayUUIDs(uCount);
|
||||
}
|
||||
|
||||
AUKN_SYM AuUInt64 RngU64Range(AuUInt64 uMin, AuUInt64 uMax)
|
||||
{
|
||||
return gFastDevice->NextU64Range(uMin, uMax);
|
||||
}
|
||||
|
||||
AUKN_SYM AuInt64 RngI64Range(AuInt64 iMin, AuInt64 iMax)
|
||||
{
|
||||
return gFastDevice->NextI64Range(iMin, iMax);
|
||||
}
|
||||
|
||||
AUKN_SYM AuVec2 RngVec2(AuVec2 boundA, AuVec2 boundB)
|
||||
{
|
||||
return gFastDevice->NextVec2(boundA, boundB);
|
||||
}
|
||||
|
||||
AUKN_SYM AuVec2 RngVec2Sorted(AuVec2 min, AuVec2 max)
|
||||
{
|
||||
return gFastDevice->NextVec2Sorted(min, max);
|
||||
}
|
||||
|
||||
AUKN_SYM AuVec3 RngVec3(AuVec3 boundA, AuVec3 boundB)
|
||||
{
|
||||
return gFastDevice->NextVec3(boundA, boundB);
|
||||
}
|
||||
|
||||
AUKN_SYM AuVec3 RngVec3Sorted(AuVec3 min, AuVec3 max)
|
||||
{
|
||||
return gFastDevice->NextVec3Sorted(min, max);
|
||||
}
|
||||
|
||||
AUKN_SYM AuVec4 RngVec4(AuVec4 boundA, AuVec4 boundB)
|
||||
{
|
||||
return gFastDevice->NextVec4(boundA, boundB);
|
||||
}
|
||||
|
||||
AUKN_SYM AuVec4 RngVec4Sorted(AuVec4 min, AuVec4 max)
|
||||
{
|
||||
return gFastDevice->NextVec4Sorted(min, max);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<AuInt64> RngArrayI64Range(AuUInt32 uCount, AuInt64 iMin, AuInt64 iMax)
|
||||
{
|
||||
return gFastDevice->NextArrayI64Range(uCount, iMin, iMax);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<AuUInt64> RngArrayU64Range(AuUInt32 uCount, AuUInt64 uMin, AuUInt64 uMax)
|
||||
{
|
||||
return gFastDevice->NextArrayU64Range(uCount, uMin, uMax);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<AuUInt32> RngArrayU32Mask(AuUInt32 uCount, AuUInt32 uMask)
|
||||
{
|
||||
return gFastDevice->NextArrayU32Mask(uCount, uMask);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<AuUInt64> RngArrayU64Mask(AuUInt32 uCount, AuUInt64 uMask)
|
||||
{
|
||||
return gFastDevice->NextArrayU64Mask(uCount, uMask);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<AuInt64> RngArrayI64(AuUInt32 uCount)
|
||||
{
|
||||
return gFastDevice->NextArrayI64(uCount);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<AuUInt64> RngArrayU64(AuUInt32 uCount)
|
||||
{
|
||||
return gFastDevice->NextArrayU64(uCount);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<AuVec2> RngArrayVec2(AuUInt32 uCount, AuVec2 boundA, AuVec2 boundB)
|
||||
{
|
||||
return gFastDevice->NextArrayVec2(uCount, boundA, boundB);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<AuVec2> RngArrayVec2Sorted(AuUInt32 uCount, AuVec2 min, AuVec2 max)
|
||||
{
|
||||
return gFastDevice->NextArrayVec2Sorted(uCount, min, max);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<AuVec3> RngArrayVec3(AuUInt32 uCount, AuVec3 boundA, AuVec3 boundB)
|
||||
{
|
||||
return gFastDevice->NextArrayVec3(uCount, boundA, boundB);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<AuVec3> RngArrayVec3Sorted(AuUInt32 uCount, AuVec3 min, AuVec3 max)
|
||||
{
|
||||
return gFastDevice->NextArrayVec3Sorted(uCount, min, max);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<AuVec4> RngArrayVec4(AuUInt32 uCount, AuVec4 boundA, AuVec4 boundB)
|
||||
{
|
||||
return gFastDevice->NextArrayVec4(uCount, boundA, boundB);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<AuVec4> RngArrayVec4Sorted(AuUInt32 uCount, AuVec4 min, AuVec4 max)
|
||||
{
|
||||
return gFastDevice->NextArrayVec4Sorted(uCount, min, max);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<AuVec4> RngArrayVec4SortedFast(AuUInt32 uCount, AuVec4 min, AuVec4 max)
|
||||
{
|
||||
return gFastDevice->NextArrayVec4SortedFast(uCount, min, max);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<AuVec3> RngArrayVec3SortedFast(AuUInt32 uCount, AuVec3 min, AuVec3 max)
|
||||
{
|
||||
return gFastDevice->NextArrayVec3SortedFast(uCount, min, max);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<AuVec2> RngArrayVec2SortedFast(AuUInt32 uCount, AuVec2 min, AuVec2 max)
|
||||
{
|
||||
return gFastDevice->NextArrayVec2SortedFast(uCount, min, max);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<double> RngArrayDoubleRangeFast(AuUInt32 uCount, double dMin, double dMax)
|
||||
{
|
||||
return gFastDevice->NextArrayDoubleRangeFast(uCount, dMin, dMax);
|
||||
}
|
||||
|
||||
AUKN_SYM AuList<double> RngArrayDecimalsFast(AuUInt32 uCount)
|
||||
{
|
||||
return gFastDevice->NextArrayDecimalsFast(uCount);
|
||||
}
|
||||
}
|
@ -51,7 +51,7 @@ namespace Aurora::RNG
|
||||
// secure rng requires no init -> we just passthrough to the global ReadSecureRNG function
|
||||
}
|
||||
|
||||
void RandomDevice::Read(Memory::MemoryViewWrite view)
|
||||
void RandomDevice::Read(Memory::MemoryViewWrite view)
|
||||
{
|
||||
if (!view)
|
||||
{
|
||||
@ -82,7 +82,7 @@ namespace Aurora::RNG
|
||||
return *(double *)(&qwValue) - 1.0;
|
||||
}
|
||||
|
||||
void RandomDevice::NextString(char *pString, AuUInt32 uLength, ERngStringCharacters type)
|
||||
void RandomDevice::NextString(char *pString, AuUInt32 uLength, ERngStringCharacters type)
|
||||
{
|
||||
static AuPair<const char *, int> rngSequence[static_cast<int>(ERngStringCharacters::eEnumCount)] =
|
||||
{
|
||||
@ -139,7 +139,7 @@ namespace Aurora::RNG
|
||||
}
|
||||
}
|
||||
|
||||
bool RandomDevice::NextBoolean()
|
||||
bool RandomDevice::NextBoolean()
|
||||
{
|
||||
if (this->def_.bSecure)
|
||||
{
|
||||
@ -181,9 +181,9 @@ namespace Aurora::RNG
|
||||
}
|
||||
}
|
||||
|
||||
AuInt32 RandomDevice::NextI32Range(AuInt32 uMin, AuInt32 uMax)
|
||||
AuInt32 RandomDevice::NextI32Range(AuInt32 iMin, AuInt32 iMax)
|
||||
{
|
||||
auto uRange = uMax - uMin;
|
||||
auto uRange = AuUInt32(iMax - iMin);
|
||||
auto uMassiveWord = NextU32();
|
||||
auto uUpperBound = AuRoundUpPow2(uRange + 1);
|
||||
AuUInt32 uNext {};
|
||||
@ -191,7 +191,7 @@ namespace Aurora::RNG
|
||||
{
|
||||
uMassiveWord = AuFnv1a32Runtime(&uMassiveWord, sizeof(uMassiveWord));
|
||||
}
|
||||
return uMin + uNext;
|
||||
return iMin + uNext;
|
||||
}
|
||||
|
||||
AuUInt32 RandomDevice::NextU32Range(AuUInt32 uMin, AuUInt32 uMax)
|
||||
@ -235,9 +235,13 @@ namespace Aurora::RNG
|
||||
// Source: https://stackoverflow.com/a/5016867
|
||||
double RandomDevice::UniformFloatInRange(double udMin, double udMax)
|
||||
{
|
||||
// No....
|
||||
#if defined(AURNG_USE_GARBAGE_DECIMALS)
|
||||
return (double(this->NextU32()) * (double(1.0) / double(AuNumericLimits<AuUInt32>::max()))) * udMax;
|
||||
|
||||
// No....
|
||||
#elif defined(AURNG_USE_UNIFORM_DECIMALS)
|
||||
|
||||
union
|
||||
{
|
||||
double f;
|
||||
@ -282,6 +286,8 @@ namespace Aurora::RNG
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
// Yes...
|
||||
#else
|
||||
#if !defined(AURNG_USE_FAST_DECIMALS)
|
||||
#define AURNG_USE_FAST_DECIMALS
|
||||
@ -299,7 +305,7 @@ namespace Aurora::RNG
|
||||
ret.resize(uCount);
|
||||
this->Read(rngBytes);
|
||||
|
||||
auto uRange = iMax - iMin;
|
||||
auto uRange = AuUInt32(iMax - iMin);
|
||||
auto uUpperBound = AuRoundUpPow2(uRange + 1);
|
||||
for (AU_ITERATE_N(uIndex, rngBytes.size()))
|
||||
{
|
||||
@ -377,6 +383,27 @@ namespace Aurora::RNG
|
||||
#endif
|
||||
}
|
||||
|
||||
AuList<double> RandomDevice::NextArrayDoubleRangeFast(AuUInt32 uCount, double dMin, double dMax)
|
||||
{
|
||||
AuList<double> 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(&uSeed, 8);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
AuList<AuInt32> RandomDevice::NextArrayI32(AuUInt32 uCount)
|
||||
{
|
||||
AuList<AuInt32> ret;
|
||||
@ -393,6 +420,435 @@ namespace Aurora::RNG
|
||||
return ret;
|
||||
}
|
||||
|
||||
AuUInt64 RandomDevice::NextU64Range(AuUInt64 uMin, AuUInt64 uMax)
|
||||
{
|
||||
auto uRange = uMax - uMin;
|
||||
auto uMassiveWord = NextU64();
|
||||
auto uUpperBound = AuRoundUpPow2(uRange + 1);
|
||||
AuUInt32 uNext {};
|
||||
while ((uNext = (uMassiveWord & (uUpperBound - 1))) > uRange)
|
||||
{
|
||||
uMassiveWord = AuFnv1a64Runtime(&uMassiveWord, sizeof(uMassiveWord));
|
||||
}
|
||||
return uMin + uNext;
|
||||
}
|
||||
|
||||
AuInt64 RandomDevice::NextI64Range(AuInt64 iMin, AuInt64 iMax)
|
||||
{
|
||||
auto uRange = AuUInt64(iMax - iMin);
|
||||
auto uMassiveWord = NextU64();
|
||||
auto uUpperBound = AuRoundUpPow2(uRange + 1);
|
||||
AuUInt32 uNext {};
|
||||
while ((uNext = (uMassiveWord & (uUpperBound - 1))) > uRange)
|
||||
{
|
||||
uMassiveWord = AuFnv1a64Runtime(&uMassiveWord, sizeof(uMassiveWord));
|
||||
}
|
||||
return iMin + uNext;
|
||||
}
|
||||
|
||||
AuVec2 RandomDevice::NextVec2(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 NextVec2Sorted(mins, maxs);
|
||||
}
|
||||
|
||||
AuVec2 RandomDevice::NextVec2Sorted(AuVec2 min, AuVec2 max)
|
||||
{
|
||||
AuVec2 range;
|
||||
range[0] = max[0] - min[0];
|
||||
range[1] = max[1] - min[1];
|
||||
|
||||
auto uSeed = this->NextU64();
|
||||
auto uComponentA = RngConvertToDecimal(uSeed);
|
||||
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
|
||||
|
||||
return AuVec2 {
|
||||
(uComponentA * range[0]) + min[0],
|
||||
(uComponentB * range[1]) + min[1]
|
||||
};
|
||||
}
|
||||
|
||||
AuVec3 RandomDevice::NextVec3(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 NextVec3Sorted(mins, maxs);
|
||||
}
|
||||
|
||||
AuVec3 RandomDevice::NextVec3Sorted(AuVec3 min, AuVec3 max)
|
||||
{
|
||||
AuVec3 range;
|
||||
range[0] = max[0] - min[0];
|
||||
range[1] = max[1] - min[1];
|
||||
range[2] = max[2] - min[2];
|
||||
|
||||
auto uSeed = this->NextU64();
|
||||
auto uComponentA = RngConvertToDecimal(uSeed);
|
||||
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
|
||||
auto uComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
|
||||
|
||||
return AuVec3 {
|
||||
(uComponentA * range[0]) + min[0],
|
||||
(uComponentB * range[1]) + min[1],
|
||||
(uComponentC * range[2]) + min[2]
|
||||
};
|
||||
}
|
||||
|
||||
AuVec4 RandomDevice::NextVec4(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 NextVec4Sorted(mins, maxs);
|
||||
}
|
||||
|
||||
AuVec4 RandomDevice::NextVec4Sorted(AuVec4 min, AuVec4 max)
|
||||
{
|
||||
AuVec4 range;
|
||||
range[0] = max[0] - min[0];
|
||||
range[1] = max[1] - min[1];
|
||||
range[2] = max[2] - min[2];
|
||||
range[3] = max[3] - min[3];
|
||||
|
||||
auto uSeed = this->NextU64();
|
||||
auto uComponentA = RngConvertToDecimal(uSeed);
|
||||
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
|
||||
auto uComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
|
||||
auto uComponentD = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
|
||||
|
||||
return AuVec4 {
|
||||
(uComponentA * range[0]) + min[0],
|
||||
(uComponentB * range[1]) + min[1],
|
||||
(uComponentC * range[2]) + min[2],
|
||||
(uComponentD * range[3]) + min[3]
|
||||
};
|
||||
}
|
||||
|
||||
AuList<AuInt64> RandomDevice::NextArrayI64Range(AuUInt32 uCount, AuInt64 iMin, AuInt64 iMax)
|
||||
{
|
||||
AuList<AuInt64> ret;
|
||||
AuList<AuInt64> 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, sizeof(uMassiveWord));
|
||||
}
|
||||
|
||||
ret[uIndex] = iMin + uRange;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
AuList<AuUInt64> RandomDevice::NextArrayU64Range(AuUInt32 uCount, AuUInt64 uMin, AuUInt64 uMax)
|
||||
{
|
||||
AuList<AuUInt64> ret;
|
||||
AuList<AuUInt64> 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, sizeof(uMassiveWord));
|
||||
}
|
||||
|
||||
ret[uIndex] = uMin + uNext;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
AuList<AuUInt32> RandomDevice::NextArrayU32Mask(AuUInt32 uCount, AuUInt32 uMask)
|
||||
{
|
||||
AuList<AuUInt32> ret;
|
||||
ret.resize(uCount);
|
||||
this->Read(ret);
|
||||
for (auto &word : ret)
|
||||
{
|
||||
word &= uMask;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
AuList<AuUInt64> RandomDevice::NextArrayU64Mask(AuUInt32 uCount, AuUInt64 uMask)
|
||||
{
|
||||
AuList<AuUInt64> ret;
|
||||
ret.resize(uCount);
|
||||
this->Read(ret);
|
||||
for (auto &word : ret)
|
||||
{
|
||||
word &= uMask;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
AuList<AuInt64> RandomDevice::NextArrayI64(AuUInt32 uCount)
|
||||
{
|
||||
AuList<AuInt64> ret;
|
||||
ret.resize(uCount);
|
||||
this->Read(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
AuList<AuUInt64> RandomDevice::NextArrayU64(AuUInt32 uCount)
|
||||
{
|
||||
AuList<AuUInt64> ret;
|
||||
ret.resize(uCount);
|
||||
this->Read(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
AuList<AuVec2> 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<AuVec2> RandomDevice::NextArrayVec2Sorted(AuUInt32 uCount, AuVec2 min, AuVec2 max)
|
||||
{
|
||||
AuVec2 range;
|
||||
AuList<AuVec2> ret;
|
||||
AuList<AuUInt64> 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 uComponentA = RngConvertToDecimal(uSeed);
|
||||
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
|
||||
|
||||
ret[uIndex] = AuVec2 {
|
||||
(uComponentA * range[0]) + min[0],
|
||||
(uComponentB * range[1]) + min[1]
|
||||
};
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
AuList<AuVec2> RandomDevice::NextArrayVec2SortedFast(AuUInt32 uCount, AuVec2 min, AuVec2 max)
|
||||
{
|
||||
AuVec2 range;
|
||||
AuList<AuVec2> 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 uComponentA = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
|
||||
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
|
||||
|
||||
ret[uIndex] = AuVec2 {
|
||||
(uComponentA * range[0]) + min[0],
|
||||
(uComponentB * range[1]) + min[1]
|
||||
};
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
AuList<AuVec3> 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<AuVec3> RandomDevice::NextArrayVec3Sorted(AuUInt32 uCount, AuVec3 min, AuVec3 max)
|
||||
{
|
||||
AuVec3 range;
|
||||
AuList<AuVec3> ret;
|
||||
AuList<AuUInt64> 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 uComponentA = RngConvertToDecimal(uSeed);
|
||||
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
|
||||
auto uComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
|
||||
|
||||
ret[uIndex] = AuVec3 {
|
||||
(uComponentA * range[0]) + min[0],
|
||||
(uComponentB * range[1]) + min[1],
|
||||
(uComponentC * range[2]) + min[2]
|
||||
};
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
AuList<AuVec3> RandomDevice::NextArrayVec3SortedFast(AuUInt32 uCount, AuVec3 min, AuVec3 max)
|
||||
{
|
||||
AuVec3 range;
|
||||
AuList<AuVec3> 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 uComponentA = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
|
||||
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
|
||||
auto uComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
|
||||
|
||||
ret[uIndex] = AuVec3 {
|
||||
(uComponentA * range[0]) + min[0],
|
||||
(uComponentB * range[1]) + min[1],
|
||||
(uComponentC * range[2]) + min[2]
|
||||
};
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
AuList<AuVec4> 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<AuVec4> RandomDevice::NextArrayVec4Sorted(AuUInt32 uCount, AuVec4 min, AuVec4 max)
|
||||
{
|
||||
AuVec4 range;
|
||||
AuList<AuVec4> ret;
|
||||
AuList<AuUInt64> 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 uComponentA = RngConvertToDecimal(uSeed);
|
||||
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
|
||||
auto uComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
|
||||
auto uComponentD = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
|
||||
|
||||
ret[uIndex] = AuVec4 {
|
||||
(uComponentA * range[0]) + min[0],
|
||||
(uComponentB * range[1]) + min[1],
|
||||
(uComponentC * range[2]) + min[2],
|
||||
(uComponentD * range[3]) + min[3]
|
||||
};
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
AuList<AuVec4> RandomDevice::NextArrayVec4SortedFast(AuUInt32 uCount, AuVec4 min, AuVec4 max)
|
||||
{
|
||||
AuVec4 range;
|
||||
AuList<AuVec4> 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 uComponentA = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
|
||||
auto uComponentB = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
|
||||
auto uComponentC = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
|
||||
auto uComponentD = RngConvertToDecimal(uSeed = (AuFnv1a64Runtime(&uSeed, 8)));
|
||||
|
||||
ret[uIndex] = AuVec4 {
|
||||
(uComponentA * range[0]) + min[0],
|
||||
(uComponentB * range[1]) + min[1],
|
||||
(uComponentC * range[2]) + min[2],
|
||||
(uComponentD * range[3]) + min[3]
|
||||
};
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
AuList<double> RandomDevice::NextArrayDouble(AuUInt32 uCount)
|
||||
{
|
||||
AuList<double> ret;
|
||||
@ -430,6 +886,22 @@ namespace Aurora::RNG
|
||||
#endif
|
||||
}
|
||||
|
||||
AuList<double> RandomDevice::NextArrayDecimalsFast(AuUInt32 uCount)
|
||||
{
|
||||
AuList<double> ret;
|
||||
|
||||
ret.resize(uCount);
|
||||
|
||||
AuUInt64 uSeed = this->NextU64();
|
||||
for (AU_ITERATE_N(uIndex, uCount))
|
||||
{
|
||||
ret[uIndex] = RngConvertToDecimal(uSeed);
|
||||
uSeed = AuFnv1a64Runtime(&uSeed, 8);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
double RandomDevice::NextDecimal()
|
||||
{
|
||||
#if defined(AURNG_USE_FAST_DECIMALS)
|
||||
|
@ -27,15 +27,40 @@ namespace Aurora::RNG
|
||||
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<AuInt32> NextArrayI32Range(AuUInt32 uCount, AuInt32 iMin, AuInt32 iMax) override;
|
||||
AuList<AuUInt32> NextArrayU32Range(AuUInt32 uCount, AuUInt32 uMin, AuUInt32 uMax) override;
|
||||
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;
|
||||
AuList<double> NextArrayDoubleRange(AuUInt32 uCount, double dMin, double dMax) override;
|
||||
AuList<double> NextArrayDoubleRangeFast(AuUInt32 uCount, double dMin, double dMax) override;
|
||||
AuList<AuInt32> NextArrayI32(AuUInt32 uCount) override;
|
||||
AuList<AuUInt32> NextArrayU32(AuUInt32 uCount) override;
|
||||
AuList<AuInt64> NextArrayI64(AuUInt32 uCount) override;
|
||||
AuList<AuUInt64> NextArrayU64(AuUInt32 uCount) override;
|
||||
AuList<AuVec2> NextArrayVec2(AuUInt32 uCount, AuVec2 boundA, AuVec2 boundB) override;
|
||||
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;
|
||||
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;
|
||||
AuList<AuVec4> NextArrayVec4Sorted(AuUInt32 uCount, AuVec4 min, AuVec4 max) override;
|
||||
AuList<AuVec4> NextArrayVec4SortedFast(AuUInt32 uCount, AuVec4 min, AuVec4 max) override;
|
||||
AuList<double> NextArrayDouble(AuUInt32 uCount) override;
|
||||
AuList<double> NextArrayDecimals(AuUInt32 uCount) override;
|
||||
AuList<double> NextArrayDecimalsFast(AuUInt32 uCount) override;
|
||||
AuList<uuids::uuid> NextArrayUUIDs(AuUInt32 uCount) override;
|
||||
|
||||
double NextDecimal() override;
|
||||
|
Loading…
Reference in New Issue
Block a user