Przeglądaj źródła

fix bug with random.choice on a string

saleml 2 lat temu
rodzic
commit
13e97f86a1
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      gym_minigrid/minigrid.py

+ 1 - 1
gym_minigrid/minigrid.py

@@ -628,7 +628,7 @@ class StringGymSpace(gym.spaces.space.Space):
 
     def sample(self):
         length = np.random.randint(self.min_length, self.max_length)
-        string = ''.join(np.random.choice(self.letters, size=length))
+        string = ''.join(np.random.choice(list(self.letters), size=length))
         return string
 
     def contains(self, x):