sequince.utils.random
=====================

.. py:module:: sequince.utils.random


Attributes
----------

.. autoapisummary::

   sequince.utils.random.RNGLike


Functions
---------

.. autoapisummary::

   sequince.utils.random.resolve_rng


Module Contents
---------------

.. py:type:: RNGLike
   :canonical: RandomGenerator | np.random.Generator | int | None


.. py:function:: resolve_rng(rng = None, *, backend = None, xp = None)

   Return an ORNG generator for the supplied RNG-like value.

   :param rng: An RNG-like value, which can be an ORNG RandomGenerator, a NumPy
               Generator, an integer seed, or None (for a default generator).
   :param backend: The backend to use for the ORNG RandomGenerator if `rng` is None or an
                   integer seed. Ignored if `rng` is an ORNG RandomGenerator or a NumPy
                   Generator.
   :param xp: An array API namespace to use for the ORNG RandomGenerator if `rng` is
              None or an integer seed. Ignored if `rng` is an ORNG RandomGenerator or
              a NumPy Generator.

   :returns: An ORNG RandomGenerator instance corresponding to the provided `rng`
             value, using the specified `backend` or `xp` if necessary.
   :rtype: RandomGenerator

   :raises TypeError: If `rng` is not an ORNG RandomGenerator, a NumPy Generator, an integer
       seed, or None.
   :raises ValueError: If both `backend` and `xp` are specified.


