code: def random_choice(self, actions=None, random_state=None):
          
          random_state = check_random_state(random_state)
  
          if actions is not None:
              n = len(actions)
          else:
              n = self.num_actions
  
          if n == 1:
              idx = 0
          else:
              idx = random_state.randint(n)
  
          if actions is not None:
              return actions[idx]
          else:
              return idx
docs: Return a pure action chosen randomly from `actions`.
  
          Parameters
          ----------
          actions : array_like(int), optional(default=None)
              An array of integers representing pure actions.
  
          random_state : int or np.random.RandomState, optional
              Random seed (integer) or np.random.RandomState instance to
              set the initial state of the random number generator for
              reproducibility. If None, a randomly initialized RandomState
              is used.
  
          Returns
          -------
          scalar(int)
              If `actions` is given, returns an integer representing a
              pure action chosen randomly from `actions`; if not, an
              action is chosen randomly from the player's all actions.