text: from typing import Dict, List, Set
  from random import choice
  
  
  class RandomizedSet:
  
      def __init__(self):
          self.vals: List[int] = []
          self.indices: Dict[int, int] = {}
  
      def insert(self, val: int) -> bool:
          if val in self.indices.keys():
              return False
  
          self.indices[val] = len(self.vals)
          self.vals.append(val)
          return True
  
      def remove(self, val: int) -> bool:
          if val not in self.indices.keys():
              return False
  
          ind = self.indices[val]
          self.indices[self.vals[-1]] = ind
          
          self.vals[ind], self.vals[-1] = self.vals[-1], self.vals[ind]
          self.vals.pop()
  
          self.indices.pop(val)
          return True
  
      def getRandom(self) -> int:
          return choice(self.vals)
  
  
  # Your RandomizedSet object will be instantiated and called as such:
  # obj = RandomizedSet()
  # param_1 = obj.insert(val)
  # param_2 = obj.remove(val)
  # param_3 = obj.getRandom()
  