glass.rng — Random number generation utilities

This module includes functions for dispatching random number generators using consistent seeds. The choice of rng generator is determined based on the array library chosen by the user.

This module should be imported manually if used outside of GLASS:

import glass.rng

General

glass.rng.default_rng(*, seed=None, xp)[source]

Dispatch a random number generator for the array backend for a given seed.

Parameters:
  • xp (ModuleType) – The array library backend to use for array operations.

  • seed (Union[int, Any, None]) – Seed for the random number generator.

Returns:

The appropriate random number generator for the array’s backend.

Return type:

Any