SeedBank can be extended to support new random number generators. Right now this only be done by adding to the SeedBank code; we intend to expose an API to register additional RNGs in the future (see issue 2).
The RNG seeding interface consists of two functions:
- is_available() bool #
This function should return a boolean indicating whether or not the RNG is available for seeding.
RNG seeding support is implemented by Python modules implementing the RNG interface.
There are several of these in the
This attribute stores a list of strings naming modules that implement the RNG interface and will be seeded when SeedBank’s global seed is set with
The initialization logic works as follows:
for seed_mod in SEED_INITIALIZERS: if isinstance(mod, str): mod = import_module(mod) if mod.is_available(): mod.seed(seed)
Internally, SeedBank uses the
SeedState class to track seeds and obtain both NumPy entropy
and integer seeds for other RNGs.
- class seedbank.SeedState(seed=None)#
Manage a root seed and facilities to derive seeds.
- property int_seed#
Get this seed as an integer.
Get n words of entropy as a NumPy array.
- derive(base, keys=None)#
Derive a new seed state.