milia.core.seeds#
Deterministic seeds derived from arbitrary keys.
Python’s built-in hash() of a string changes between processes (it is salted
by PYTHONHASHSEED), so seeding from it does not reproduce. seed()
hashes the keys’ repr with BLAKE2 instead, which is stable everywhere.
Functions
|
A numpy generator seeded from |
|
A reproducible 32-bit seed from any sequence of keys. |
- milia.core.seeds.seed(*keys)#
A reproducible 32-bit seed from any sequence of keys.
- Parameters:
*keys (
object) – Values identifying the draw, e.g. an injection name, an entity and a day.- Return type:
- Returns:
An integer in
[0, 2**32), the same in every process.
Examples
>>> seed("stuck", 3, 7) == seed("stuck", 3, 7) True >>> seed("stuck", 3, 7) == seed("drift", 3, 7) False