This problem is impossible to solve for given rules and a random numbers shuffle. To better visualize it in your head, imagine that your traveling point is a head of a snake in the snake game (but snake always grows, so it's tail stays at the start)
At some point you may enclose yourself, and you can only spiral inwards until you crash into your own body. The same thing happens here. If visited cells form closed area and your traveling point is is inside of it, you can't escape out of this area (because you can visit cell only once). So after some number of moves it will reach cell where every neighbour of it was already visited