View source on GitHub |
Base class establishing interface for stateful value generation.
A ValueGenerator
maintains a state, and each time next
is called, a new
value is generated and the state is advanced.
Methods
initialize
@abc.abstractmethod
initialize()
Makes an initialized state for the ValueGenerator.
Returns | |
---|---|
An initial state. |
next
@abc.abstractmethod
next( state )
Gets next value and advances the ValueGenerator.
Args | |
---|---|
state
|
The current state. |
Returns | |
---|---|
A pair (value, new_state) where value is the next value and new_state is the advanced state. |