mirror of
https://github.com/TokTok/c-toxcore
synced 2026-05-11 08:27:03 +00:00
40ce0bce66
On some stdlibs, `size_t` doesn't exist in the global namespace. Fixes #3020.
34 lines
683 B
C++
34 lines
683 B
C++
#ifndef C_TOXCORE_TESTING_SUPPORT_RANDOM_H
|
|
#define C_TOXCORE_TESTING_SUPPORT_RANDOM_H
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <vector>
|
|
|
|
#include "../../../toxcore/attributes.h"
|
|
|
|
// Forward declaration
|
|
struct Random;
|
|
|
|
namespace tox::test {
|
|
|
|
/**
|
|
* @brief Abstraction over the random number generator.
|
|
*/
|
|
class RandomSystem {
|
|
public:
|
|
virtual ~RandomSystem();
|
|
|
|
virtual uint32_t uniform(uint32_t upper_bound) = 0;
|
|
virtual void bytes(uint8_t *_Nonnull out, std::size_t count) = 0;
|
|
|
|
/**
|
|
* @brief Returns C-compatible Random struct.
|
|
*/
|
|
virtual struct Random c_random() = 0;
|
|
};
|
|
|
|
} // namespace tox::test
|
|
|
|
#endif // C_TOXCORE_TESTING_SUPPORT_RANDOM_H
|