def METHOD_NAME(self, shape, density=1.0):
    if density == 1.0:
        return np.ones(shape, dtype=bool)
    else:
        rows, cols = shape
        num = int((rows * cols) * density)
        vec = np.zeros(int(rows * cols), dtype=bool)
        vec[:num] = True
        np.random.shuffle(vec)
        return vec.reshape(shape)