code: def bernoulli(
      prob=None,
      logit=None,
      size=None,
      dtype=None,
      device=None,
      out=None,
  ):
      """Creates a Bernoulli distribution parameterized by :attr:`prob`
      or :attr:`logit` (but not both).
  
      Samples are binary (0 or 1). They take the value `1` with probability `p`
      and `0` with probability `1 - p`.
  
      Parameters
      ----------
      prob : float, ndarray
          The probability of sampling '1'.
          Only one of prob or logit should be passed in.
      logit : float, ndarray
          The log-odds of sampling '1'.
          Only one of prob or logit should be passed in.
      size : int or tuple of ints, 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.
      dtype : dtype, optional
          Desired dtype of the result. All dtypes are determined by their
          name, i.e., 'int64', 'int', etc, so byteorder is not available
          and a specific precision may have different C types depending
          on the platform. The default value is 'np.float32'.
      device : Device, optional
          Device context of output. Default is current device.
      out : symbol, optional
          The output symbol (default is `None`).
  
      Returns
      -------
      out : ndarray
          Drawn samples from the parameterized bernoulli distribution.
  
      Examples
      --------
      >>> prob = np.random.uniform(size=(4,4))
      >>> logit = np.log(prob) - np.log(1 - prob)
      >>> npx.random.bernoulli(logit=logit)
      array([[0., 1., 1., 1.],
          [0., 1., 1., 1.],
          [0., 1., 0., 0.],
          [1., 0., 1., 0.]])
  
      >>> npx.random.bernoulli(prob=prob)
      array([[0., 1., 0., 1.],
          [1., 1., 1., 1.],
          [1., 1., 1., 0.],
          [1., 0., 1., 0.]])
      """
      return _mx_nd_npx.random.bernoulli(
          prob, logit, size, dtype, device, out
      )
  
imports: from ..None import random
  from ..ndarray import numpy_extension
  from ..util import wrap_ctx_to_device_func
label_desc: Use image node_id 2 for calling a global function with example usage: bernoulli(prob, logit, size, dtype, device, out) and returns: _mx_nd_npx