VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
Random.cpp
Go to the documentation of this file.
1
#include <
VoltMod/Core/Random.hpp
>
2
#include <random>
3
4
namespace
VoltMod
5
{
6
7
std::size_t
RandomIndex
(std::size_t
count
)
8
{
9
if
(
count
== 0)
10
{
11
return
0;
12
}
13
14
// Seeded once per process; game code is single-threaded, so no synchronisation is needed.
15
static
std::mt19937
rng
{std::random_device{}()};
16
return
std::uniform_int_distribution<std::size_t>(0,
count
- 1)(
rng
);
17
}
18
19
}
// namespace VoltMod
Random.hpp
VoltMod
Definition
Options.hpp:13
VoltMod::RandomIndex
std::size_t RandomIndex(std::size_t count)
Definition
Random.cpp:7
VoltMod::ReadFile
static std::string ReadFile(const std::filesystem::path &path)
Definition
Loader.cpp:56
src
Core
Random.cpp
Generated by
1.9.8