class Alea::ZPF6329

Included Modules

Defined in:

engines/zpf6329.cr

Constant Summary

STATE_STORAGE_32 = 4
STATE_STORAGE_64 = 2

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(seed32 : UInt32, seed64 : UInt64) #

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.

@references:

  • Alea::Mulberry32(4)#init_state.
  • Alea::SplitMix64(2)#init_state.

@exceptions:

  • Alea::UndefinedError if any of seed32 or seed64 is negative.

[View source]
def self.new(seed32 : Int, seed64 : Int) #

Initializes the PRNG with initial seeds.

@parameters:

  • seed32: value as input to init. the state of 32-bit generators of prng.
  • seed64: value as input to init. the state of 64-bit generators of prng.

[View source]
def self.new(seed : Int) #

Initializes the PRNG with initial seed.

@parameters:

  • seed: initial seed as input for generating the state of prng.

[View source]
def self.new #

Initializes the PRNG with initial seeds readed from system resources.


[View source]

Class Method Detail

def self.secure #

Returns an instamce of this PRNG with initial seeds readed from system resources.


[View source]

Instance Method Detail

def next_u32 : UInt32 #

Generate a uniform-distributed random UInt32.

@examples:

rng = Alea::ZPF6329.new
rng.next_u32 # => 1767702788

[View source]
def next_u64 : UInt64 #

Generate a uniform-distributed random UInt64.

@examples:

rng = Alea::ZPF6329.new
rng.next_u64 # => 9136120204379184874

[View source]