I did something similar once with a custom tree task, that would remember whether the last move was a “zig” or a “zag” and then set it’s next destination to a direction left or right of where it was currently at.
BIGTIMEMASTER’s idea would probably also work.
Probably depends on what you need to do while moving