UNPKG

@informalsystems/quint

Version:

Core tool for the Quint specification language

29 lines (28 loc) 982 B
/** * An interface to a random number generator that has the following property: * At any point in time we can extract the current state `s` and use it later to * reproduce the same sequence of numbers: `f[s], f[s + 1], ...`. */ export interface Rng { /** * Get the current state of the RNG, which can be reset with `setState`. */ getState(): bigint; /** * Reset the RNG with a previously obtained state. */ setState(state: bigint): void; /** * Produce the next pseudo-random big integer in the range [0, bound) * using the current state. Advance the state. * * @param bound a non-negative big integer that is used as the bound */ next(bound: bigint): bigint; } /** * Create a new instance of Rng, given the supplied initial state. * If no initial state is given, the generator is initialized from the current * time and other system state. */ export declare const newRng: (initialState?: bigint) => Rng;