def METHOD_NAME(self, mask: MaskNDArray | None = None) -> NDArray[np.int8]:
    """Generates a single random sample from this space.
    A sample is drawn by independent, fair coin tosses (one toss per binary variable of the space).
    Args:
        mask: An optional np.ndarray to mask samples with expected shape of ``space.shape``.
            For mask == 0 then the samples will be 0 and mask == 1 then random samples will be generated.
            The expected mask shape is the space shape and mask dtype is `np.int8`.
    Returns:
        Sampled values from space
    """
    if mask is not None:
        assert isinstance(
            mask, np.ndarray
        ), f"The expected type of the mask is np.ndarray, actual type: {type(mask)}"
        assert (
            mask.dtype == np.int8
        ), f"The expected dtype of the mask is np.int8, actual dtype: {mask.dtype}"
        assert (
            mask.shape == self.shape
        ), f"The expected shape of the mask is {self.shape}, actual shape: {mask.shape}"
        assert np.all(
            (mask == 0) | (mask == 1) | (mask == 2)
        ), f"All values of a mask should be 0, 1 or 2, actual values: {mask}"
        return np.where(
            mask == 2,
            self.np_random.integers(low=0, high=2, size=self.n, dtype=self.dtype),
            mask.astype(self.dtype),
        )
    return self.np_random.integers(low=0, high=2, size=self.n, dtype=self.dtype)