REF matplotlib protect, use np.random instead of pylab