BLRandom Struct Reference

Simple pseudo random number generator.

The current implementation uses a PRNG called XORSHIFT+, which has 64-bit seed, 128 bits of state, and full period 2^128 - 1.

Based on a paper by Sebastiano Vigna: http://vigna.di.unimi.it/ftp/papers/xorshiftplus.pdf

Public Members

Member Functions

Construction & Destruction
Overloaded Operators
Common Functionality
Random Numbers

Member Function Documentation

BLResult BLRandom::reset(uint64_t seed = 0)

Resets the random number generator to the given seed.

Always returns BL_SUCCESS.

bool BLRandom::equals(const BLRandom& other) const

Tests whether the random number generator is equivalent to other.

Random number generator would only be equivalent to other if it was initialized from the same seed and has the same internal state.

uint64_t BLRandom::nextUInt64()

Returns the next pseudo-random uint64_t value and advances its state.

uint32_t BLRandom::nextUInt32()

Returns the next pseudo-random uint32_t value and advances its state.

double BLRandom::nextDouble()

Returns the next pseudo-random double precision floating point in [0..1) range and advances its state.