Fix distort_random for distributed meshes

Previously, distort_random produced unconnected meshes for distributed meshes. Now we don't move vertices that belong to two or more different processes. The resulting mesh is connected.
I may not be seeing this correctly in the patch, but aren't you only declaring the 1d function here? What about the case of dim=2, dim=3?