(self, x, fun, p=0.1)
returns sometimes np.NaN, otherwise fun(x)
returns sometimes np.NaN, otherwise fun(x)
returns sometimes np . NaN otherwise fun ( x )
def somenan(self, x, fun, p=0.1):
        """returns sometimes np.NaN, otherwise fun(x)"""
        if np.random.rand(1) < p:
            return np.NaN
        else:
            return fun(x)
def somenan ( self , x , fun , p = 0.1 ) : if np . random . rand ( 1 ) < p : return np . NaN else : return fun ( x )