Alea::XSR256
Inherits Alea::PRNG < Reference < Object
Alea::XSR256, pseudo-random number generator loaded with 256 bits of state
and therefore a period of 2^256 -1. It is slower (2x) than Alea::XSR128.
If more period is needed, check out Alea::MT19937.
Constants
Constructors
Initializes the PRNG with initial seeds.
@parameters:
seed32: value as input to init. the state of 32-bit generators.seed64: value as input to init. the state of 64-bit generators.
@note: both 32-bit and 64-bit states are internally processed
as arrays of UInt64, and so is the type of seeds.
@references:
Alea::Core::SplitMix64(4)#init_state.
@exceptions:
Alea::UndefinedErrorif any ofseed32orseed64is negative.
Initializes the PRNG with initial seeds.
@parameters:
seed32: value as input to init. the state of 32-bit generators ofprng.seed64: value as input to init. the state of 64-bit generators ofprng.
Initializes the PRNG with initial seed.
@parameters:
seed: initial seed as input for generating the state ofprng.
Class methods
Instance methods
Performs an advance over the 32-bit state.
This is the equivalent of 2^128 calls to #next_u32.
@parameters:
long: flag to advance the state by2^192calls.
Performs an advance over the 32-bit state.
This is the equivalent of 2^128 calls to #next_u32.
@parameters:
long: flag to advance the state by2^192calls.
Generate a uniform-distributed random UInt32.
@examples:
rng = Alea::XSR128.new
rng.next_u32 # => 1767702788
Generate a uniform-distributed random UInt64.
@examples:
rng = Alea::XSR256.new
rng.next_u # => 9136120204379184874