class_docstr: A space consisting of finitely many elements.
  
  This class represents a finite subset of integers, more specifically a set of the form :math:`\{ a, a+1, \dots, a+n-1 \}`.
  
  Example::
  
      >>> Discrete(2)            # {0, 1}
      >>> Discrete(3, start=-1)  # {-1, 0, 1}
class_docstr_tok: ["A","space","consisting","of","finitely","many","elements",".","This","class","represents","a","finite","subset","of","integers",",","more","specifically","a","set","of","the","form",":","math",":","`","\\","{","a",",","a+1",",","\\dots",",","a+n-1","\\","}","`",".","Example",":",":",">",">",">","Discrete","(","2",")","#","{","0",",","1","}",">",">",">","Discrete","(","3",",","start=-1",")","#","{","-1",",","0",",","1","}"]
docstr: Constructor of :class:`Discrete` space.
  
  This will construct the space :math:`\{\text{start}, ..., \text{start} + n - 1\}`.
  
  Args:
      n (int): The number of elements of this space.
      seed: Optionally, you can use this argument to seed the RNG that is used to sample from the ``Dict`` space.
      start (int): The smallest element of this space.
docstr_tok: ["Constructor","of",":","class",":","`","Discrete","`","space",".","This","will","construct","the","space",":","math",":","`","\\","{","\\text","{","start","}",",","...",",","\\text","{","start","}","+","n","-","1\\","}","`",".","Args",":","n","(","int",")",":","The","number","of","elements","of","this","space",".","seed",":","Optionally",",","you","can","use","this","argument","to","seed","the","RNG","that","is","used","to","sample","from","the","``","Dict","``","space",".","start","(","int",")",":","The","smallest","element","of","this","space","."]
code: def __init__(
      self,
      n: int,
      seed: Optional[Union[int, np.random.Generator]] = None,
      start: int = 0,
  ):
      r"""Constructor of :class:`Discrete` space.
  
      This will construct the space :math:`\{\text{start}, ..., \text{start} + n - 1\}`.
  
      Args:
          n (int): The number of elements of this space.
          seed: Optionally, you can use this argument to seed the RNG that is used to sample from the ``Dict`` space.
          start (int): The smallest element of this space.
      """
      assert isinstance(n, (int, np.integer))
      assert n > 0, "n (counts) have to be positive"
      assert isinstance(start, (int, np.integer))
      self.n = int(n)
      self.start = int(start)
      super().__init__((), np.int64, seed)
  
file_path: gym/gym/spaces/discrete.py
imports: from typing import Optional, Union
  import numpy
  from gym.spaces.space import Space
label_desc: Use image node_id 1 to create a new Discrete object from inherited base classes: Space with example: obj = Discrete(n, seed, start)