code: def digit(self, to_bin: bool = False) -> Union[str, int]:
          
          digit = self.random.randint(0, 9)
  
          if to_bin:
              return bin(digit)
  
          return digit
docs: Get a random digit.
  
          :param to_bin: If True then convert to binary.
          :return: Digit.
  
          :Example:
              4.