Improper.Rng (improper v0.1.0)
A fully deterministic PRNG with the ability to fork new sub-RNGs in a tree structure.
Forks generate their own stream of randomness, but are seeded from the original stream.
A port of java's SplittableRandom as presented in this paper on page 13
Summary
Types
gamma changes every time we split the generator
the seed is changed every time we generate randomness
Functions
Creates a new Rng from a seed.
Generates a random 64-bit float in the 0-1 range, returning the float and a replacement Rng.
Generates a random 32-bit integer in the full integer range, returning the integer and a replacement Rng.
Generates a random 64-bit integer in the full integer range, returning the integer and a replacement Rng.
Splits one Rng into two.
Types
@opaque gamma()
gamma changes every time we split the generator
@opaque seed()
the seed is changed every time we generate randomness
Functions
new(seed)
Creates a new Rng from a seed.
Example:
Improper.Rng.new(ExUnit.configuration()[:seed])
next_f64_nif(_, _)
next_float(self)
Generates a random 64-bit float in the 0-1 range, returning the float and a replacement Rng.
next_i32(self)
Generates a random 32-bit integer in the full integer range, returning the integer and a replacement Rng.
next_i32_nif(_, _)
next_i64(self)
Generates a random 64-bit integer in the full integer range, returning the integer and a replacement Rng.
next_i64_between_nif(_, _, _, _)
next_i64_nif(_, _)
next_i64_under_nif(_, _, _)
split(self)
Splits one Rng into two.