public static Entity G_PickTarget(String targetname) {
    int num_choices = 0;
    Entity choice[] = new Entity[MAXCHOICES];

    if (targetname == null) {
      ServerGame.PF_dprintf("G_PickTarget called with null targetname\n");
      return null;
    }

    EntityIterator es = null;

    while ((es = G_Find(es, findByTarget, targetname)) != null) {
      choice[num_choices++] = es.o;
      if (num_choices == MAXCHOICES) break;
    }

    if (num_choices == 0) {
      ServerGame.PF_dprintf("G_PickTarget: target " + targetname + " not found\n");
      return null;
    }

    return choice[Lib.rand() % num_choices];
  }
 public static void ShutdownGame() {
   ServerGame.PF_dprintf("==== ShutdownGame ====\n");
 }