Random motion

I followed the random motion tut but it´s not working.

www.kirupa.com/developer/actionscript/random_movement.htm

Where should I put that code? in a frame or in the Mc or both?

thanks