import java.util.Collections;
import java.util.ArrayList;
import java.util.Random;
import java.util.List;
public class RandomString {
public static String generate_rand_string_without_repetition_(int size) {
final String characters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
List<Character> charList = new ArrayList<Character>();
for (char ch : characters.toCharArray()) {
charList.add(ch);
}
Collections.shuffle(charList, new Random());
StringBuilder rand_string = new StringBuilder();
for (int i = 0; i < size; i++) {
rand_string.append(charList.get(i));
}
return rand_string.toString();
}
public static void main(String[] args) {
int length = 15;
String randomString = generate_rand_string_without_repetition_(length);
System.out.println(randomString);
}
}
/*
run:
Mz7Rnx50GilrJtD
*/