code: def sample_batch_transitions(self, batch_size, history_length):
          
          # Sample from up to total size
          if self.current_size < self.buffer_capacity:
              # -1 because we cannot take the last one
              return np.random.choice(self.current_size - 1, batch_size, replace=False)
          else:
              candidate = np.random.choice(self.buffer_capacity, batch_size, replace=False)
  
              forbidden_ones = (
                      np.arange(self.current_idx, self.current_idx + history_length)
                      % self.buffer_capacity
              )
  
              # Exclude these frames for learning as they may have some part of history overwritten
              while any(x in candidate for x in forbidden_ones):
                  candidate = np.random.choice(self.buffer_capacity, batch_size, replace=False)
  
              return candidate
docs: Return indexes of next sample