From d9f9bba3c9b56c42d7b0c3b1453ac35b0eaaca62 Mon Sep 17 00:00:00 2001 From: Reece Date: Tue, 13 Jul 2021 13:13:21 +0100 Subject: [PATCH] [*] Inline RNG header functions --- Include/Aurora/RNG/RNG.hpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Include/Aurora/RNG/RNG.hpp b/Include/Aurora/RNG/RNG.hpp index 9f10f4a1..58810821 100644 --- a/Include/Aurora/RNG/RNG.hpp +++ b/Include/Aurora/RNG/RNG.hpp @@ -65,29 +65,27 @@ namespace Aurora::RNG string[i] = pair.first[static_cast(idx)]; } } - - static bool RngBoolean() - { - AuUInt8 x[1]; - Read(x); - return x[0] > 127; - } - static AuUInt8 RngByte() + static inline AuUInt8 RngByte() { AuUInt8 x[1]; Read(x); return x[0]; } + + static inline bool RngBoolean() + { + return RngByte() > 127; + } template - static T &RngArray(T *items, AuUInt count) + static inline T &RngArray(T *items, AuUInt count) { return items[static_cast(std::floor(static_cast(RngByte()) / 255.f * static_cast(count - 1))]; } template - static T &RngVector(const AuList &items) + static inline T &RngVector(const AuList &items) { return RngArray(items.data(), items.size()); }