parameterize random function

Per @wasade's suggestion, the random function that random_distance_matrix uses is now a default parameter.