Jazz2::Scripting::Legacy::jjRNG class

A seedable pseudo-random number generator.

Each instance has a state of its own, so the same seed always produces the same sequence of numbers, regardless of other random numbers the game or other scripts use.

Public static functions

static auto Create(std::uint64_t seed) -> jjRNG*
Creates a generator seeded with the given value.

Constructors, destructors, conversion operators

jjRNG(std::uint64_t seed)
Creates a new instance seeded with the given value.
~jjRNG()

Public functions

void AddRef()
Increments the reference count.
void Release()
Decrements the reference count.
auto operator()() -> std::uint64_t
Advances the generator and returns the next 64-bit number.
auto operator=(const jjRNG& o) -> jjRNG&
Copies the state of another generator.
auto operator==(const jjRNG& o) const -> bool
Returns whether both refer to the same generator object, the states aren't compared.
void seed(std::uint64_t value)
Resets the generator to the state given by a seed.
void discard(std::uint64_t count)
Advances the generator without returning the numbers.

Function documentation

void Jazz2::Scripting::Legacy::jjRNG::discard(std::uint64_t count)

Advances the generator without returning the numbers.