DicEx.RNG.Seeded (dicEx v0.3.0)

Copy Markdown View Source

A reproducible RNG with its own :rand state, threaded through the roller.

This is what DicEx.roll/2's :seed option uses. The state lives in the {DicEx.RNG.Seeded, state} tuple, so seeding never touches the calling process's global :rand state:

DicEx.roll("4d6", rng: DicEx.RNG.Seeded.new(42))
# same as
DicEx.roll("4d6", seed: 42)

Summary

Functions

Builds a seeded RNG state from an integer seed.

Functions

new(seed)

Builds a seeded RNG state from an integer seed.