scippuncertainty.random.make_rngs#

scippuncertainty.random.make_rngs(seed, *, n)[source]#

Instantiate new random number generators.

Creates the given number of random generators using numpy.random.default_rng() with numpy.random.SeedSequence. n separate seed sequences are spawned from seed and generators constructed from those. These generators are independent with high probability which makes them usable in a multithreaded context.

The function logs the initial entropy and details of the RNGs so the RNGs can be re-created later.

See Parallel Random Number Generation in numpy for details.

Note

make_rngs(x, n=1)[0] is not the same as np.random.default_rng(x) but np.random.default_rng(np.random.SeedSequence(x).spawn(1)[0])

Parameters:
Returns:

list[Generator] – List of n random generators.