From 044ef73cd6e3ecbd4d3b22dd83ae36791c82d16f Mon Sep 17 00:00:00 2001 From: Nathan Hui Date: Fri, 13 Dec 2024 11:44:54 -0800 Subject: [PATCH] feat: Adds glibc implementation --- src/util.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/util.cpp b/src/util.cpp index 16533b3..da2a03e 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -15,6 +15,8 @@ #include "consts.hpp" #include "product.hpp" +#include + /** * \brief A macro that stores the the size of each line of output as a constant 16 bytes */ @@ -67,7 +69,10 @@ int SF::utils::random(int min, int max) { #if SF_PLATFORM == SF_PLATFORM_PARTICLE return ::random(min, max); -#elif SF_PLATFORM == SF_PLATFORM_GCC -#error +#elif SF_PLATFORM == SF_PLATFORM_GLIBC + std::random_device rd; + std::mt19937 gen(rd()); + std::uniform_int_distribution<> distrib(min, max + 1); + return distrib(gen); #endif } \ No newline at end of file