package cactusServer.entities; import java.util.Set; import org.apache.commons.lang3.RandomStringUtils; public class RandomStringGenerator { public static final String ALPHA_NUMERIC = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; public String createRandomString(int num, String seed) { return RandomStringUtils.random(num, seed); } public boolean checkString(String str, Set<String> set) { return set.contains(str); } public String createUniqueString(int num, String seed, Set<String> set) { String str; do { str = createRandomString(num, seed); } while (checkString(str, set)); return str; } }