Skip to content
fn

default_generator

→Generator&
Generator & default_generator()

Returns the process-wide default Generator instance.

See Also

lucid.manual_seed — Python convenience wrapper.

Returns

Generator&

Reference to the global singleton, lazily constructed on first access with seed = 0. Lifetime persists for the duration of the process.

Notes

All random ops that are not given an explicit generator= kwarg route through this singleton. Python's lucid.manual_seed(seed) is implemented by calling Generator::set_seed on the object returned here.

Examples

Re-seed every distribution-op call across the whole process::
    default_generator().set_seed(42);
    // every subsequent randn / uniform / bernoulli sees seed=42