Alea::Core::Knuth32(N)
Inherits Struct < Value < Object
Knuth32(N)generator to initialize aNsized state for the pseudo-random number generators. NOTE:N` refers to the size in bits of the state divided by 32.
The algorithm comes from https://github.com/numpy/numpy/blob/master/numpy/random/src/mt19937/mt19937.c.
state = Alea::Core::Knuth32(4).init_state 93u32
state # => StaticArray[93, 1052567986, 1433826620, 220522004]
Constructors
new
SourceClass methods
init_state(seed : UInt32)
Generate a state to be used by PRNGs as a StaticArray(UInt32, N).
@parameters:
seed: initial seed; it must be anUInt32.
Instance methods
initialize
Source