VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
Random.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4
5namespace VoltMod
6{
7
8/**
9 * A uniformly random index in `[0, count)`, or 0 when @p count is 0.
10 *
11 * The framework's single source of randomness, so features that need a random pick (`@random`
12 * targeting, a random menu entry) do not each seed their own generator - or fall back to
13 * something like the tick counter, which repeats within a frame.
14 *
15 * Game-thread only; the generator is not synchronised.
16 */
17std::size_t RandomIndex(std::size_t count);
18
19} // namespace VoltMod
std::size_t RandomIndex(std::size_t count)
Definition Random.cpp:7
static std::string ReadFile(const std::filesystem::path &path)
Definition Loader.cpp:56