import java.util.Random;
public class Test {
public static void main(final String[] args) {
final String romaji = "abcdefghijklmnopqrstuvwxyz";
final String number = "0123456789";
final String generator = romaji + romaji.toUpperCase() +number;
System.out.println(getStr(generator, 10));
System.out.println(getStr(generator, 10));
System.out.println(getStr(generator, 10));
}
private static String getStr(final String input, final int length) {
final Random random = new Random();
final int num = input.length();
final StringBuilder sb = new StringBuilder();
final char[] chars = input.toCharArray();
for (int i = 0; i < 10; i++) {
sb.append(chars[random.nextInt(num)]);
}
return sb.toString();
}
}
Recommended Posts