Decorum.PRNG (decorum v0.1.2)
PRNG (pseudo random number generator) is a wrapper around the :rand module.
It has 2 states:
Random Uses
:randto generate random numbers and stores each one in history.Hardcoded Used to replay a previously recorded (or simplified) history.
We represent random values using 32-bit non-negative integers because they are easier to work with when shrinking the history.
Summary
Functions
Takes a PRNG struct and returns a tuple with the next random value
and an updated PRNG struct.
Types
@opaque t()
Functions
next!(prng)
@spec next!(prng :: t()) :: {non_neg_integer(), t()}
Takes a PRNG struct and returns a tuple with the next random value
and an updated PRNG struct.
When in Random state, next!/1 is not expected to fail.
When in Hardcoded state, next!/1 could raise a Decorum.EmptyHistoryError.
Generators will call next!/1 to get a value to use when
generating test values. They should also return the updated PRNG struct.