make_rng#

bamengine.make_rng(seed=None)[source]#

Create a new random number generator.

This is the recommended way to create RNGs for use with BAM Engine. Under the hood, this uses NumPy’s default_rng, which provides the modern Generator API with better statistical properties than the legacy RandomState.

Parameters:

seed (int | None) – Seed for reproducibility. If None, uses a random seed.

Returns:

A NumPy random number generator (np.random.Generator).

Return type:

Rng

Examples

>>> import bamengine as bam
>>> rng = bam.make_rng(42)  # Reproducible
>>> rng.normal(0, 1, size=10)  # Use standard NumPy methods
>>> rng2 = bam.make_rng()  # Random seed

See also

numpy.random.default_rng

The underlying NumPy function