Skip to content

Commit

Permalink
feat: Adds glibc implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
ntlhui committed Dec 13, 2024
1 parent c4126e1 commit 044ef73
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include "consts.hpp"
#include "product.hpp"

#include <random>

/**
* \brief A macro that stores the the size of each line of output as a constant 16 bytes
*/
Expand Down Expand Up @@ -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
}

0 comments on commit 044ef73

Please sign in to comment.