class
#include <nCine/Base/Random.h>
RandomGenerator Random number generator.
Constructors, destructors, conversion operators
- RandomGenerator() noexcept
- Creates a new generator with default seeds.
-
RandomGenerator(std::
uint64_t initState, std:: uint64_t initSequence) noexcept - Creates a new generator with the specified seeds.
Public functions
-
void Initialize(std::
uint64_t initState, std:: uint64_t initSequence) noexcept - Initializes the generator with the specified seeds.
-
auto Next() -> std::
uint32_t noexcept - Generates a uniformly distributed `32-bit number.
-
auto Next(std::
uint32_t min, std:: uint32_t max) -> std:: uint32_t noexcept - Generates a uniformly distributed `32-bit number, r, where min <= r < max.
- auto NextFloat() -> float noexcept
- Generates a uniformly distributed float number, r, where 0 <= r < 1.
- auto NextFloat(float min, float max) -> float noexcept
- Generates a uniformly distributed float number, r, where min <= r < max.
- auto NextBool() -> bool noexcept
-
auto Fast(std::
uint32_t min, std:: uint32_t max) -> std:: uint32_t noexcept - Faster but less uniform version of
integer()
- auto FastFloat() -> float noexcept
- Faster but less uniform version of
real()
- auto FastFloat(float min, float max) -> float noexcept
- Faster but less uniform version of
real()
-
template<class T>void Shuffle(Containers::
ArrayView<T> data) noexcept