1import java.util.Random;
2
3public class Generator {
4 public static String generateRandomPassword(int len) {
5 String chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk"
6 +"lmnopqrstuvwxyz!@#$%&";
7 Random rnd = new Random();
8 StringBuilder sb = new StringBuilder(len);
9 for (int i = 0; i < len; i++)
10 sb.append(chars.charAt(rnd.nextInt(chars.length())));
11 return sb.toString();
12 }
13}