This commit is contained in:
3
src/Utilities/Random.cpp
Normal file
3
src/Utilities/Random.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "Random.hpp"
|
||||
|
||||
std::mt19937_64 Porygon::Utilities::Random::_rng;
|
||||
20
src/Utilities/Random.hpp
Normal file
20
src/Utilities/Random.hpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef PORYGONLANG_RANDOM_HPP
|
||||
#define PORYGONLANG_RANDOM_HPP
|
||||
#include <random>
|
||||
|
||||
namespace Porygon::Utilities {
|
||||
class Random {
|
||||
static std::mt19937_64 _rng;
|
||||
public:
|
||||
static void Seed(uint64_t new_seed) {
|
||||
_rng.seed(new_seed);
|
||||
}
|
||||
|
||||
static inline long Get() {
|
||||
return _rng.operator()();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //PORYGONLANG_RANDOM_HPP
|
||||
Reference in New Issue
Block a user