AuroraRuntime/Include/Aurora/RNG/RNG.hpp

232 lines
12 KiB
C++
Raw Normal View History

2021-06-27 21:25:29 +00:00
/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: RNG.hpp
2021-09-06 10:58:08 +00:00
Date: 2021-7-14
2021-06-27 21:25:29 +00:00
Author: Reece
***/
#pragma once
2021-09-06 10:58:08 +00:00
#include "ERngStringCharacters.hpp"
[*/+/-] MEGA COMMIT. ~2 weeks compressed. The intention is to quickly improve and add util apis, enhance functionality given current demands, go back to the build pipeline, finish that, publish runtime tests, and then use what we have to go back to to linux support with a more stable api. [+] AuMakeSharedArray [+] Technet ArgvQuote [+] Grug subsystem (UNIX signal thread async safe ipc + telemetry flusher + log flusher.) [+] auEndianness -> Endian swap utils [+] AuGet<N>(...) [*] AUE_DEFINE conversion for ECompresionType, EAnsiColor, EHashType, EStreamError, EHexDump [+] ConsoleMessage ByteBuffer serialization [+] CmdLine subsystem for parsing command line arguments and simple switch/flag checks [*] Split logger from console subsystem [+] StartupParameters -> A part of a clean up effort under Process [*] Refactor SysErrors header + get caller hack [+] Atomic APIs [+] popcnt [+] Ring Buffer sink [+] Added more standard errors Catch, Submission, LockError, NoAccess, ResourceMissing, ResourceLocked, MalformedData, InSandboxContext, ParseError [+] Added ErrorCategorySet, ErrorCategoryClear, GetStackTrace [+] IExitSubscriber, ETriggerLevel [*] Write bias the high performance RWLockImpl read-lock operation operation [+] ExitHandlerAdd/ExitHandlerRemove (exit subsystem) [*] Updated API style Digests [+] CpuId::CpuBitCount [+] GetUserProgramsFolder [+] GetPackagePath [*] Split IStreamReader with an inl file [*] BlobWriter/BlobReader/BlobArbitraryReader can now take shared pointers to bytebuffers. default constructor allocates a new scalable bytebuffer [+] ICharacterProvider [+] ICharacterProviderEx [+] IBufferedCharacterConsumer [+] ProviderFromSharedString [+] ProviderFromString [+] BufferConsumerFromProvider [*] Parse Subsystem uses character io bufferer [*] Rewritten NT's high perf semaphore to use userland SRW/ConVars [like mutex, based on generic semaphore] [+] ByteBuffer::ResetReadPointer [*] Bug fix bytebuffer base not reset on free and some scaling issues [+] ProcessMap -> Added kSectionNameStack, kSectionNameFile, kSectionNameHeap for Section [*] ProcessMap -> Refactor Segment to Section. I was stupid for keeping a type conflict hack API facing [+] Added 64 *byte* fast RNG seeds [+] File Advisorys/File Lock Awareness [+] Added extended IAuroraThread from OS identifier caches for debug purposes [*] Tweaked how memory is reported on Windows. Better consistency of what values mean across functions. [*] Broke AuroraUtils/Typedefs out into a separate library [*] Update build script [+] Put some more effort into adding detail to the readme before rewriting it, plus, added some media [*] Improved public API documentation [*] Bug fix `SetConsoleCtrlHandler` [+] Locale TimeDateToFileNameISO8601 [+] Console config stdOutShortTime [*] Begin using internal UTF8/16 decoders when platform support isnt available (instead of stl) [*] Bug fixes in decoders [*] Major bug fix, AuMax [+] RateLimiter [+] Binary file sink [+] Log directory sink [*] Data header usability (more operators) [+] AuRemoveRange [+] AuRemove [+] AuTryRemove [+] AuTryRemoveRange [+] auCastUtils [+] Finish NewLSWin32Source [+] AuTryFindByTupleN, AuTryRemoveByTupleN [+] Separated AuRead/Write types, now in auTypeUtils [+] Added GetPosition/SetPosition to FileWriter [*] Fix stupid AuMin in place of AuMax in SpawnThread.Unix.Cpp [*] Refactored Arbitrary readers to SeekingReaders (as in, they could be atomic and/or parallelized, and accept an arbitrary position as a work parameter -> not Seekable, as in, you can simply set the position) [*] Hack back in the sched deinit [+] File AIO loop source interop [+] Begin to prototype a LoopQueue object I had in mind for NT, untested btw [+] Stub code for networking [+] Compression BaseStream/IngestableStreamBase [*] Major: read/write locks now support write-entrant read routines. [*] Compression subsystem now uses the MemoryView concept [*] Rewrite the base stream compressions, made them less broken [*] Update hashing api [*] WriterTryGoForward and ReaderTryGoForward now revert to the previous relative index instead of panicing [+] Added new AuByteBuffer apis Trim, Pad, WriteFrom, WriteString, [TODO: ReadString] [+] Added ByteBufferPushReadState [+] Added ByteBufferPushWriteState [*] Move from USC-16 to full UTF-16. Win32 can handle full UTF-16. [*] ELogLevel is now an Aurora enum [+] Raised arbitrary limit in header to 255, the max filter buffer [+] Explicit GZip support [+] Explicit Zip support [+] Added [some] compressors et al
2022-02-17 00:11:40 +00:00
#include "RandomDef.hpp"
2021-09-06 10:58:08 +00:00
#include "IRandomDevice.hpp"
2021-06-27 21:25:29 +00:00
namespace Aurora::RNG
{
// May return any length between 1 and uBytes
using RngGetBytesProvider_f = AuUInt32(*)(AuUInt8 *pBuffer, AuUInt32 uBytes);
2021-09-06 10:58:08 +00:00
AUKN_SYM void SetSecureRNGBackendOverload(RngGetBytesProvider_f pSecureBackend);
AUKN_SYM RngGetBytesProvider_f GetSecureRNGBackendOverload();
AUKN_SYM RngGetBytesProvider_f GetSecureRNGBackend();
AUKN_SYM void ReadSecureRNG(Memory::MemoryViewWrite writeView);
AUKN_SYM void ReadFastRNG (Memory::MemoryViewWrite writeView);
AUKN_SYM AuString ReadString(AuUInt32 uLength, ERngStringCharacters type = ERngStringCharacters::eAlphaCharacters);
AUKN_SYM void RngString(char *pString, AuUInt32 uLength, ERngStringCharacters type = ERngStringCharacters::eAlphaCharacters);
AUKN_SYM AuUInt8 RngByte();
AUKN_SYM bool RngBoolean();
AUKN_SYM AuUInt32 RngU32();
AUKN_SYM AuUInt32 RngU32Range(AuUInt32 uMin, AuUInt32 uMax);
AUKN_SYM AuInt32 RngI32Range(AuInt32 iMin, AuInt32 iMax);
[+] 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
2024-04-22 05:02:56 +00:00
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<AuInt32> RngArrayI32RangeFast(AuUInt32 uCount, AuInt32 iMin, AuInt32 iMax);
AUKN_SYM AuList<AuUInt32> RngArrayU32Range(AuUInt32 uCount, AuUInt32 uMin, AuUInt32 uMax);
AUKN_SYM AuList<AuUInt32> RngArrayU32RangeFast(AuUInt32 uCount, AuUInt32 uMin, AuUInt32 uMax);
[+] 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
2024-04-22 05:02:56 +00:00
AUKN_SYM AuList<AuInt64> RngArrayI64Range(AuUInt32 uCount, AuInt64 iMin, AuInt64 iMax);
AUKN_SYM AuList<AuInt64> RngArrayI64RangeFast(AuUInt32 uCount, AuInt64 iMin, AuInt64 iMax);
[+] 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
2024-04-22 05:02:56 +00:00
AUKN_SYM AuList<AuUInt64> RngArrayU64Range(AuUInt32 uCount, AuUInt64 uMin, AuUInt64 uMax);
AUKN_SYM AuList<AuUInt64> RngArrayU64RangeFast(AuUInt32 uCount, AuUInt64 uMin, AuUInt64 uMax);
[+] 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
2024-04-22 05:02:56 +00:00
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);
[+] 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
2024-04-22 05:02:56 +00:00
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);
[+] 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
2024-04-22 05:02:56 +00:00
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> RngArrayVec2Fast(AuUInt32 uCount, AuVec2 boundA, AuVec2 boundB);
[+] 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
2024-04-22 05:02:56 +00:00
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> RngArrayVec3Fast(AuUInt32 uCount, AuVec3 boundA, AuVec3 boundB);
[+] 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
2024-04-22 05:02:56 +00:00
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> RngArrayVec4Fast(AuUInt32 uCount, AuVec4 boundA, AuVec4 boundB);
[+] 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
2024-04-22 05:02:56 +00:00
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);
[+] 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
2024-04-22 05:02:56 +00:00
AUKN_SYM AuList<double> RngArrayDecimalsFast(AuUInt32 uCount);
AUKN_SYM AuList<uuids::uuid> RngArrayUUIDs(AuUInt32 uCount);
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);
2021-09-06 10:58:08 +00:00
// Note: it is conceivable that someone may want the following templates for some cryptographic purpose
template<bool fast = true, typename T, int N>
2022-02-20 20:59:06 +00:00
static auline void RngFillArray(T(&array)[N])
2021-06-27 21:25:29 +00:00
{
if constexpr (fast)
{
ReadFastRNG(Memory::MemoryViewWrite(array));
}
else
{
ReadSecureRNG(Memory::MemoryViewWrite(array));
}
2021-06-27 21:25:29 +00:00
}
template<bool fast = true, typename T>
static auline void RngFillArray(T *array, AuUInt32 uCount)
2021-06-27 21:25:29 +00:00
{
if constexpr (fast)
{
ReadFastRNG(Memory::MemoryViewWrite(array, uCount * sizeof(T)));
}
else
{
ReadSecureRNG(Memory::MemoryViewWrite(array, uCount * sizeof(T)));
}
2021-06-27 21:25:29 +00:00
}
template<bool fast = true, typename T>
2023-04-19 02:17:45 +00:00
static auline void RngFillRange(T &container)
{
RngFillArray<fast>(container.begin(), container.end() - container.begin());
}
static auline void RngFillBuffer(Memory::ByteBuffer &buffer)
{
auto view = buffer.GetNextLinearWrite();
RngFillRange(view);
buffer.writePtr += view.length;
}
/**
* @brief
* @deprecated
*/
static auline void RngFillRange(Memory::ByteBuffer &buffer)
{
RngFillBuffer(buffer);
}
2021-09-06 10:58:08 +00:00
template<bool fast = true, typename T>
2022-02-20 20:59:06 +00:00
static auline T RngTmpl()
2021-06-27 21:25:29 +00:00
{
2021-09-06 10:58:08 +00:00
T ret {};
if constexpr (fast)
2021-06-27 21:25:29 +00:00
{
ReadFastRNG(Memory::MemoryViewWrite(&ret, sizeof(T)));
2021-09-06 10:58:08 +00:00
}
else
2021-06-27 21:25:29 +00:00
{
ReadSecureRNG(Memory::MemoryViewWrite(&ret, sizeof(T)));
2021-06-27 21:25:29 +00:00
}
2021-09-06 10:58:08 +00:00
return ret;
2021-07-13 12:13:21 +00:00
}
template<typename T>
static auline T &RngArray(T *pItems, AuUInt32 uCount)
{
return pItems[RngIndex(uCount)];
}
2024-01-17 17:46:31 +00:00
template<typename T>
inline T RngIterator(T begin, T end)
{
auto nextItr = begin;
auto uCount = std::distance(begin, end);
std::advance(nextItr, RngIndex(uCount));
return nextItr;
}
template<typename T>
static auline auto RngRange(T &items)
{
return RngIterator(std::begin(items), std::end(items));
}
template<typename T>
static auline T &RngList(AuList<T> &items)
{
2024-01-17 17:46:31 +00:00
return *RngRange(items);
}
2022-02-20 20:25:39 +00:00
template<typename T>
static auline const T &RngList(const AuList<T> &items)
2022-02-20 20:25:39 +00:00
{
2024-01-17 17:46:31 +00:00
return *RngRange(items);
2022-02-20 20:25:39 +00:00
}
template<typename T>
inline void RngShuffleIterators(T begin, T end)
{
AU_DEBUG_MEMCRUNCH;
auto uCount = std::distance(begin, end);
auto nextIndexArray = RngArrayU32RangeFast(uCount, 0, uCount - 1);
for (AU_ITERATE_N(i, AuUInt(uCount)))
{
auto nextItrA = begin;
auto nextItrB = begin;
std::advance(nextItrA, i);
std::advance(nextItrB, nextIndexArray[i]);
AuSwap(*nextItrA, *nextItrB);
}
}
template<typename T>
inline void RngShuffleList(AuList<T> &list)
{
RngShuffleIterators(list.begin(), list.end());
}
2021-06-27 21:25:29 +00:00
}