For random moving enemys you should use Greenfoot.getRandomNumber(int) which returns a random number between 0 and the number you used as parameter -1.
To end the game when an enemy touches you you should use this:
if (getOneIntersectingObject(Enemy.class) != null) {
Greenfoot.stop();
}
If you put this code in the actor you control the game will end when an enemy touches this actor.
If your enemy class is named different than Enemy you have to use the classname of your enemy class instead of Enemy.class.