Add a typecheck for the RNG setter
@@ -1194,7 +1194,12 @@ class DiscreteDistributionLabeled(DiscreteDistribution):
@RNG.setter
def RNG(self, value):
- self.dataset.attrs['RNG'] = value
+ if isinstance(value, np.random.RandomState):
+ self.dataset.attrs["RNG"] = value
+ else:
+ raise ValueError(
+ "The RNG property must be an instance of numpy.random.RandomState"
+ )
@property
def name(self):
