package com.dlila.pwdgen;

import java.security.SecureRandom;

public class PwdGen {

  private static final int LEN = 10;
  private static final String CHARS;

  static {
    String chars = "abcdefghijklmnopqrstuvwxyz";
    chars += chars.toUpperCase();
    chars += "1234567890!@#$%^&*()=+-+";
    CHARS = chars;
  }

  public static void main(String[] argv) {
    SecureRandom random = new SecureRandom();
    StringBuilder b = new StringBuilder(LEN);
    for (int i = 0; i < LEN; i++) {
      b.append(CHARS.charAt(random.nextInt(CHARS.length())));
    }
    System.out.println(b.toString());
  }
}

@@ -1,30 +1,51 @@
-package com.dlila.pwdgen;%0A
+import java.util.HashSet;%0Aimport java.util.Set;
 %0Aimp
@@ -99,17 +99,16 @@
 wdGen %7B%0A
-%0A
   privat
@@ -133,18 +133,19 @@
  LEN = 1
-0;
+6; 
 %0A  priva
@@ -306,17 +306,30 @@
 %5E&*()=+-
-+
+%5B%5D%7B%7D%3C%3E,.%60~/?%7C'
 %22;%0A    C
@@ -341,16 +341,286 @@
 = chars;
+%0A%0A    // verify that there are no duplicates in CHARS%0A    Set%3CCharacter%3E charSet = new HashSet%3C%3E();%0A    for (Character c : CHARS.toCharArray()) %7B%0A      charSet.add(c);%0A    %7D   %0A    if (charSet.size() != CHARS.length()) %7B%0A      throw new IllegalStateException();%0A    %7D   
 %0A  %7D%0A%0A  
@@ -855,16 +855,19 @@
 );%0A    %7D
+   
 %0A    Sys

improve PWGEN