I feel like it could be better.
New()
while(src)
if(New_Ent)
New_x = x
New_y = y
New_Ent = 0
sleep(rand(1,2))
var/Dir = pick(1,2,3,4)
if(Dir == 1)
if((x + 1) <= (New_x + Max_Move))
Move(locate(x+1,y,z))
if(Dir == 2)
if((x - 1) >= (New_x - Max_Move))
Move(locate(x-1,y,z))
if(Dir == 3)
if((y + 1) <= (New_y + Max_Move))
Move(locate(x,y+1,z))
if(Dir == 4)
if((y - 1) >= (New_y - Max_Move))
Move(locate(x,y-1,z))
Also, here are a couple of ways I thought of doing it.
The second way is probably the nicer of the two.