Changed the sample_equal_by_distance to recieve the inputs from sample_equal function