Added a utility function for perturbing an array