changed from np.power to ** in generate_random (Network version)