Refactored get_rand_neighbors()