mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-22 07:02:19 +00:00
Delete prng.py (#1196)
* Delete prng.py Since it seems like this seeding function is rarely used. * Update __init__.py * Update kellycoinflip.py * Update core.py * Update box.py * Update discrete.py * Update multi_binary.py * Update multi_discrete.py * Update test_determinism.py * Update test_determinism.py * Update test_determinism.py * Update core.py * Update box.py * Update test_determinism.py * Update core.py * Update box.py * Update discrete.py * Update multi_binary.py * Update multi_discrete.py * Update dict_space.py * Update tuple_space.py * Update core.py * Create space.py * Update __init__.py * Update __init__.py * Update box.py * Update dict_space.py * Update discrete.py * Update dict_space.py * Update multi_binary.py * Update multi_discrete.py * Update tuple_space.py * Update discrete.py * Update box.py * Update dict_space.py * Update multi_binary.py * Update multi_discrete.py * Update tuple_space.py * Update multi_discrete.py * Update multi_binary.py * Update dict_space.py * Update box.py * Update test_determinism.py * Update kellycoinflip.py * Update space.py
This commit is contained in:
@@ -1,13 +1,19 @@
|
||||
import gym
|
||||
import numpy as np
|
||||
from .space import Space
|
||||
|
||||
class MultiBinary(gym.Space):
|
||||
|
||||
class MultiBinary(Space):
|
||||
def __init__(self, n):
|
||||
self.n = n
|
||||
gym.Space.__init__(self, (self.n,), np.int8)
|
||||
super().__init__((self.n,), np.int8)
|
||||
self.np_random = np.random.RandomState()
|
||||
|
||||
def seed(self, seed):
|
||||
self.np_random.seed(seed)
|
||||
|
||||
def sample(self):
|
||||
return gym.spaces.np_random.randint(low=0, high=2, size=self.n).astype(self.dtype)
|
||||
return self.np_random.randint(low=0, high=2, size=self.n).astype(self.dtype)
|
||||
|
||||
def contains(self, x):
|
||||
return ((x==0) | (x==1)).all()
|
||||
|
Reference in New Issue
Block a user