Assuming this is in GM, you can do the movement with alarms. Set the alarm to a random time, then when it executes, generate a random number from 0-3 (or 1-4 if that's easier for you). Make each possibility a direction (0 is up, 1 is right, 2 is down, 3 is left, for example). Make the NPC move in that direction, and set a second alarm to make the NPC stop. When the second alarm goes off, stop the NPC, and reset the first alarm.