Fixed random movement generator

Maximum path length can now be provided

This should prevent creatures from deep inside a cave to move outside just
because the randomly generated position was outside of the cave.