OK, let me explain 'dis a bit:
Every time you move to an area, the roaming Pokemon will move around. From its current location, it may move into a random route nearby it's current location. So if it was at Route 2, it could simply go up to Route 3 or go back to Route 1. So to answer the question it depends if the Pokemon is in a location that can go up or down, otherwise, it is a random generator.