class_docstr: A (possibly unbounded) box in :math:`\mathbb{R}^n`.
  
  Specifically, a Box represents the Cartesian product of n closed intervals.
  Each interval has the form of one of :math:`[a, b]`, :math:`(-\infty, b]`,
  :math:`[a, \infty)`, or :math:`(-\infty, \infty)`.
  
  There are two common use cases:
  
  * Identical bound for each dimension::
  
      >>> Box(low=-1.0, high=2.0, shape=(3, 4), dtype=np.float32)
      Box(3, 4)
  
  * Independent bound for each dimension::
  
      >>> Box(low=np.array([-1.0, -2.0]), high=np.array([2.0, 4.0]), dtype=np.float32)
      Box(2,)
docstr: Generates a single random sample inside the Box.
  
  In creating a sample of the box, each coordinate is sampled (independently) from a distribution
  that is chosen according to the form of the interval:
  
  * :math:`[a, b]` : uniform distribution
  * :math:`[a, \infty)` : shifted exponential distribution
  * :math:`(-\infty, b]` : shifted negative exponential distribution
  * :math:`(-\infty, \infty)` : normal distribution
  
  Args:
      mask: A mask for sampling values from the Box space, currently unsupported.
  
  Returns:
      A sampled value from the Box
docstr_tok: ["Generates","a","single","random","sample","inside","the","Box",".","In","creating","a","sample","of","the","box",",","each","coordinate","is","sampled","(","independently",")","from","a","distribution","that","is","chosen","according","to","the","form","of","the","interval",":","*",":","math",":","`","[","a",",","b","]","`",":","uniform","distribution","*",":","math",":","`","[","a",",","\\infty",")","`",":","shifted","exponential","distribution","*",":","math",":","`","(","-\\infty",",","b","]","`",":","shifted","negative","exponential","distribution","*",":","math",":","`","(","-\\infty",",","\\infty",")","`",":","normal","distribution","Args",":","mask",":","A","mask","for","sampling","values","from","the","Box","space",",","currently","unsupported",".","Returns",":","A","sampled","value","from","the","Box"]
code: def sample(self, mask: None = None) -> np.ndarray:
      r"""Generates a single random sample inside the Box.
  
      In creating a sample of the box, each coordinate is sampled (independently) from a distribution
      that is chosen according to the form of the interval:
  
      * :math:`[a, b]` : uniform distribution
      * :math:`[a, \infty)` : shifted exponential distribution
      * :math:`(-\infty, b]` : shifted negative exponential distribution
      * :math:`(-\infty, \infty)` : normal distribution
  
      Args:
          mask: A mask for sampling values from the Box space, currently unsupported.
  
      Returns:
          A sampled value from the Box
      """
      if mask is not None:
          raise gym.error.Error(
              f"Box.sample cannot be provided a mask, actual value: {mask}"
          )
  
      high = (
          self.high
          if self.dtype.kind == "f"
          else self.high.astype("int64") + 1
      )
      sample = np.empty(self.shape)
  
      # Masking arrays which classify the coordinates according to interval
      # type
      unbounded = ~self.bounded_below & ~self.bounded_above
      upp_bounded = ~self.bounded_below & self.bounded_above
      low_bounded = self.bounded_below & ~self.bounded_above
      bounded = self.bounded_below & self.bounded_above
  
      # Vectorized sampling by interval type
      sample[unbounded] = self.np_random.normal(
          size=unbounded[unbounded].shape
      )
  
      sample[low_bounded] = (
          self.np_random.exponential(
              size=low_bounded[low_bounded].shape
          )
          + self.low[low_bounded]
      )
  
      sample[upp_bounded] = (
          -self.np_random.exponential(
              size=upp_bounded[upp_bounded].shape
          )
          + self.high[upp_bounded]
      )
  
      sample[bounded] = self.np_random.uniform(
          low=self.low[bounded],
          high=high[bounded],
          size=bounded[bounded].shape,
      )
      if self.dtype.kind == "i":
          sample = np.floor(sample)
  
      return sample.astype(self.dtype)
  
imports: from typing import Dict, List, Optional, Sequence, SupportsFloat, Tuple, Type, Union
  import numpy
  import gym.error
  from gym import logger
  from gym.spaces.space import Space
label_desc: Use image node_id 5 for calling the Box obj's underlying member method code with example usage: obj.sample(mask) and returns: sample