MultithreadedRNG#

class caput.algorithms.random.MultithreadedRNG(seed: int | None = None, threads: int | None = None, bitgen=None)[source]#

Bases: numpy.random.Generator

A multithreaded random number generator.

This wraps specific methods to allow generation across multiple threads. The following methods are supported:

  • random

  • integers

  • uniform

  • normal

  • standard_normal

  • poisson

  • power

Parameters:
seedint | None, optional

The seed to use.

threadsint | None, optional

The number of threads to use. If not set, this tries to get the number from the OMP_NUM_THREADS environment variable, or just uses 4 if that is also not set.

bitgenBitGenerator | None, optional

The BitGenerator to use, if not set this uses _default_bitgen.