implemented random path search