1#ifndef GAME_PRNG_H
2#define GAME_PRNG_H
3
4#include <cstdint>
5
6class CPrng
7{
8public:
9 // Creates an unseeded instance.
10 CPrng();
11
12 // The name of the random number generator including the current seed.
13 const char *Description() const;
14
15 // Seeds the random number generator with the given integer. The random
16 // sequence obtained by calling `RandomBits()` repeatedly is guaranteed
17 // to be the same for the same seed.
18 void Seed(uint64_t aSeed[2]);
19
20 // Generates 32 random bits. `Seed()` must be called before calling
21 // this function.
22 unsigned int RandomBits();
23
24private:
25 char m_aDescription[64];
26
27 bool m_Seeded;
28 uint64_t m_State;
29 uint64_t m_Increment;
30};
31
32#endif // GAME_PRNG_H
33