add random_path function