package monsters;

import java.util.Random;

import monsters.Monster;
import monsters.interfaces.MTIndexInterface;
import monsters.animals.GiantDuck;
import monsters.animals.SquirrelGold;
import monsters.humans.GunMan;
import monsters.humans.KnifeMan;

/**
 * Randomized Monster instance generator. Notice that the generator
 * method is static - no need initilization. Within any class 
 * out here, which imports this class, call it like this:  
 *
 *          Monster m = RandomMonsterGen.GET();
 *
 *  @author Wonho Lim
 */
public class RandomMonsterGen implements MTIndexInterface {
    
    private static int rnGen()
    {
        return  new Random().nextInt ( DEFAULT_MONSTER_KINDS_NUMBER );
    }
    
    public static Monster GET()
    {
        switch ( rnGen() ) {
            case MTI_ANIMAL_GIANT_DUCK:     return new GiantDuck();
            case MTI_HUMAN_GUN_MAN:         return new GunMan();
            case MTI_HUMAN_KNIFE_MAN:       return new KnifeMan();
            case MTI_ANIMAL_SQUIRREL_GOLD:  return new SquirrelGold();
        
            default:                        return null;
        }
    }
}

@@ -252,16 +252,17 @@
 %0A%0A/**%0A *
+ 
  Randomi
@@ -321,16 +321,17 @@
 rator%0A *
+ 
  method 
@@ -385,16 +385,17 @@
 lass %0A *
+ 
  out her
@@ -449,20 +449,16 @@
   %0A *%0A *
-    
       Mo

Update RandomMonsterGen.java