// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.util.Random;

public class PasswordGen {
   public static void main(String[] args) {
      for(int i = 0; i < 10; i++) {
         System.out.println(newpassword(7));
      }
   }
   private final static char[] valid = { 'A', 'B', 'C', '1', '2', '3' };
   private final static Random rng = new Random();
   public static String newpassword(int l) {
      StringBuffer sb = new StringBuffer("");
      for(int i = 0; i < l; i++)  {
         sb.append(valid[rng.nextInt(valid.length)]);
      }
      return sb.toString();
   }
}
