Seed the default generator from the OS cryptographic entropy source.
Reads 8 bytes from the operating system's secure random pool
(/dev/urandom on macOS / Linux, CryptGenRandom on Windows)
and uses them as the 63-bit Philox seed key :
The 63-bit mask ensures the seed fits comfortably in a signed
int64, which is required by the C++ Generator API.
After seeding, the RNG counter is reset to .
Returns
intThe 63-bit seed value that was applied, so the caller can log or checkpoint it for later reproducibility.
Notes
Unlike manual_seed, successive calls to seed produce different
streams with overwhelming probability ( possible seeds).
Use this at the start of non-reproducible training runs and log
the return value so you can reproduce the exact run later with
lucid.manual_seed(returned_value) if needed.
The OS entropy pool on Apple Silicon is hardware-backed (the Secure Enclave contributes entropy), so the seeds are cryptographically unpredictable.
Examples
>>> import lucid
>>> s = lucid.seed()
>>> isinstance(s, int) and 0 <= s < 2**63
True
Log and reproduce:
>>> s = lucid.seed()
>>> print(f"Run seed: {s}")
>>> # Later, to reproduce:
>>> lucid.manual_seed(s)