API Reference¶
- exhaust.space(fn, verbose=False)¶
Return an iterable that generates values from
fnfully exhausting the state space.During iteration, the function
fnis called repeatedly with aStateinstance as only argument.
- class exhaust.State(verbose=False)¶
An instance of this class is passed as argument to the function passed to
space().- choice(seq)¶
Return an element from the non-empty sequence
seq.This is the equivalent of
random.choice().- Parameters
seq (
Iterable[~T]) – The sequence from which to choose from.- Raises
IndexError – if
seqis empty.- Return type
~T
- choices(population, *, k=1)¶
Return a
ksized list of elements chosen from thepopulationwith replacement.This is the equivalent of
random.choices(), minus theweightsandcum_weightsarguments.- Parameters
- Raises
IndexError – if
populationis empty.- Return type
List[~T]
- randint(a, b)¶
Return an integer
Nsuch thata <= N <= b. Alias forrandrange(a, b+1).This is the equivalent of
random.randint().- Parameters
- Raises
ValueError – if the range is empty.
- Return type
- randrange(stop: int) int¶
- randrange(start: int, stop: int, step: Optional[int] = None) int
Return an element from
range(start, stop, step).This is the equivalent of
random.randrange().- Parameters
start – The start of the range.
stop – The end of the range (exclusive).
step – The step size.
- Raises
ValueError – if the range is empty.
- Return type
- sample(population, k, *, counts=None)¶
Return a
ksized list of unique elements chosen from thepopulation.This is the equivalent of
random.sample().