2021-03-28 20:57:43 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <random>
|
|
|
|
#include <memory>
|
2022-07-16 23:19:40 +00:00
|
|
|
#include <vector>
|
2021-03-28 20:57:43 +00:00
|
|
|
|
|
|
|
namespace Rand {
|
|
|
|
extern std::unique_ptr<std::mt19937> generator;
|
|
|
|
|
2021-04-04 10:41:04 +00:00
|
|
|
void init(uint64_t seed);
|
2021-03-28 20:57:43 +00:00
|
|
|
|
|
|
|
int32_t rand(int32_t startInclusive, int32_t endExclusive);
|
|
|
|
int32_t rand(int32_t endExclusive);
|
|
|
|
int32_t rand();
|
|
|
|
|
|
|
|
int32_t randWeighted(const std::vector<int32_t>& weights);
|
|
|
|
|
2022-07-23 22:29:19 +00:00
|
|
|
uint64_t cryptoRand();
|
|
|
|
|
2021-03-28 20:57:43 +00:00
|
|
|
float randFloat(float startInclusive, float endExclusive);
|
|
|
|
float randFloat(float endExclusive);
|
|
|
|
float randFloat();
|
|
|
|
};
|