Add the perturb() function and its tests.