simpeg.typing.RandomSeed#

simpeg.typing.RandomSeed[source]#

A typing.Union for random seeds and Numpy’s random number generators.

These type of variables can be used throughout simpeg to control random states of functions and classes. These variables can either be an integer that will be used as a seed to define a Numpy’s numpy.random.Generator, or a predefined random number generator.

Examples

>>> import numpy as np
>>> from simpeg.typing import RandomSeed
>>>
>>> def my_function(seed: RandomSeed = None):
...     rng = np.random.default_rng(seed=seed)
...     ...

alias of Union[int, ndarray, SeedSequence, BitGenerator, Generator]