localWalker.walk(MYAREA.getRandomPosition(0));Is what I'd do.
Sometimes, if your character moves far enough away though, it won't walk back into the area.
There was also a line of code someone posted on here where they filtered out every cow they couldn't attack, then stored it into an array, then rolled a random number that was no greater than the arrays length to pick what cow to attack. On mobile, so I don't want to type it all out.