mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-07 19:23:49 +03:00
19 lines
364 B
C++
19 lines
364 B
C++
![]() |
#include "framework.h"
|
||
|
#include "prng.h"
|
||
|
#include <limits>
|
||
|
|
||
|
namespace T5M::Math::Random
|
||
|
{
|
||
|
static std::mt19937 Engine;
|
||
|
|
||
|
int32_t generateInt(int32_t low, int32_t high)
|
||
|
{
|
||
|
return std::clamp(static_cast<int32_t>(Engine()), low, high);
|
||
|
}
|
||
|
|
||
|
float generateFloat(float low, float high)
|
||
|
{
|
||
|
return (high - low) * Engine() / Engine.max() + low;
|
||
|
}
|
||
|
}
|