def sample(self, n=1):
        if not type(n) is int:
            raise TypeError("Number of samples must be integer")

        if n <= 0:
            raise ValueError("Number of samples (%d) needs to be positive", n)
        
        r = rand(n, self.dimension)
        s = asarray(r <= self.ps, dtype=bool)
        return Sample(s)
dataset/ETHPy150Open karlnapf/kameleon-mcmc/kameleon_mcmc/distribution/Bernoulli.py/Bernoulli.sample/original