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()withnumpy.random.SeedSequence.nseparate seed sequences are spawned fromseedand 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 asnp.random.default_rng(x)butnp.random.default_rng(np.random.SeedSequence(x).spawn(1)[0])