deepmd.utils.random
===================

.. py:module:: deepmd.utils.random


Functions
---------

.. autoapisummary::

   deepmd.utils.random.choice
   deepmd.utils.random.random
   deepmd.utils.random.seed
   deepmd.utils.random.shuffle


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

.. py:function:: choice(a: numpy.ndarray | int, size: int | tuple[int, Ellipsis] | None = None, replace: bool = True, p: numpy.ndarray | None = None) -> numpy.ndarray | int

   
   Generates a random sample from a given 1-D array.


   :Parameters:

       **a** : 1-D :term:`numpy:array_like` or :class:`python:int`
           If an ndarray, a random sample is generated from its elements. If an int,
           the random sample is generated as if it were np.arange(a)

       **size** : :class:`python:int` or :class:`python:tuple` :obj:`of` :obj:`ints`, :obj:`optional`
           Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples
           are drawn. Default is None, in which case a single value is returned.

       **replace** : :ref:`bool <python:bltin-boolean-values>`, :obj:`optional`
           Whether the sample is with or without replacement. Default is True, meaning
           that a value of a can be selected multiple times.

       **p** : 1-D :term:`numpy:array_like`, :obj:`optional`
           The probabilities associated with each entry in a. If not given, the sample
           assumes a uniform distribution over all entries in a.



   :Returns:

       :obj:`np.ndarray <numpy.ndarray>`
           arrays with results and their shapes











   ..
       !! processed by numpydoc !!

.. py:function:: random(size: int | tuple[int, Ellipsis] | None = None) -> float | numpy.ndarray

   
   Return random floats in the half-open interval [0.0, 1.0).


   :Parameters:

       **size**
           Output shape.



   :Returns:

       :obj:`np.ndarray <numpy.ndarray>`
           Arrays with results and their shapes.











   ..
       !! processed by numpydoc !!

.. py:function:: seed(val: int | list[int] | None = None) -> None

   
   Seed the generator.


   :Parameters:

       **val** : :class:`python:int`
           Seed.














   ..
       !! processed by numpydoc !!

.. py:function:: shuffle(x: numpy.ndarray) -> None

   
   Modify a sequence in-place by shuffling its contents.


   :Parameters:

       **x** : :obj:`np.ndarray <numpy.ndarray>`
           The array or list to be shuffled.














   ..
       !! processed by numpydoc !!

