struct Alea::Core::Mulberry32(N)

Overview

Mulberry32(N) generator to initialize a N sized 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://gist.github.com/tommyettinger/46a874533244883189143505d203312c.

state = Alea::Core::Mulberry32(4).init_state 93u32
state # => StaticArray[1079867279, 1912516084, 2459043021, 3508473169]

Defined in:

alea/core/cgen.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Class Method Detail

def self.init_state(seed : UInt32) #

Generate a state to be used by PRNGs as a StaticArray(UInt32, N).

@parameters:

  • seed: initial seed; it must be an UInt32.

[View source]

Instance Method Detail

def initialize #

[View source]