|
pure-cpp 1.0.0
A C++ physics simulation benchmark comparing performance with Python implementations
|
A 32-bit Permuted Congruential Generator (pcg32). More...
#include <pcg_random.hpp>

Public Types | |
| using | result_type = uint32_t |
| The result type of the generator, required by the UniformRandomBitGenerator concept. More... | |
Public Member Functions | |
| Pcg32 () | |
| Default constructor. Initializes the generator with a default seed. More... | |
| Pcg32 (uint64_t seed) | |
| Constructs the generator with a specific seed. More... | |
| void | seed (uint64_t init_seed) |
| Seeds the random number generator. More... | |
| result_type | operator() () |
| Generates the next random number in the sequence. More... | |
| void | discard (unsigned long long z) |
| Discards a specified number of values from the sequence. More... | |
Static Public Member Functions | |
| static constexpr result_type | min () |
| Returns the minimum value the generator can produce. More... | |
| static constexpr result_type | max () |
| Returns the maximum value the generator can produce. More... | |
Private Attributes | |
| uint64_t | state_ |
| The internal state of the generator. More... | |
| uint64_t | inc_ |
| The stream selector, which determines the sequence. Must be odd. More... | |
Friends | |
| bool | operator== (const Pcg32 &lhs, const Pcg32 &rhs) |
| Checks if two generators have the same internal state. More... | |
| bool | operator!= (const Pcg32 &lhs, const Pcg32 &rhs) |
| Checks if two generators have different internal states. More... | |
A 32-bit Permuted Congruential Generator (pcg32).
This class implements the UniformRandomBitGenerator concept from the C++ standard library, making it compatible with distribution classes like std::uniform_int_distribution and std::uniform_real_distribution.
Definition at line 37 of file pcg_random.hpp.
| using Rng::Pcg32::result_type = uint32_t |
The result type of the generator, required by the UniformRandomBitGenerator concept.
Definition at line 41 of file pcg_random.hpp.
|
inline |
Default constructor. Initializes the generator with a default seed.
Definition at line 63 of file pcg_random.hpp.
|
inlineexplicit |
Constructs the generator with a specific seed.
| seed | The initial seed value for the generator's state. |
Definition at line 69 of file pcg_random.hpp.

|
inline |
Discards a specified number of values from the sequence.
| z | The number of values to discard. |
Definition at line 104 of file pcg_random.hpp.
|
inlinestaticconstexpr |
Returns the maximum value the generator can produce.
Definition at line 55 of file pcg_random.hpp.
|
inlinestaticconstexpr |
Returns the minimum value the generator can produce.
Definition at line 47 of file pcg_random.hpp.
|
inline |
Generates the next random number in the sequence.
Definition at line 89 of file pcg_random.hpp.
|
inline |
Seeds the random number generator.
| init_seed | The seed value. The stream is also initialised based on this seed. |
Definition at line 77 of file pcg_random.hpp.

Checks if two generators have different internal states.
Definition at line 122 of file pcg_random.hpp.
Checks if two generators have the same internal state.
Definition at line 115 of file pcg_random.hpp.
|
private |
The stream selector, which determines the sequence. Must be odd.
Definition at line 133 of file pcg_random.hpp.
|
private |
The internal state of the generator.
Definition at line 128 of file pcg_random.hpp.