In this example the mover selects a random waypoint to move to. When the waypoint is reached, another waypoint is randomly selected.
The code uses a handy helper function called randomChoice
which selects and returns a random member of any list.
function randomChoice(list) {
var i = Math.floor( Math.random()*list.length );
return list[i];
}