import org.apache.commons.lang.RandomStringUtils;
public class MainClass {
public static void main(String[] args) {
//Random 8 chars string using only the elements in the array aChars
//Only charcters between place 0 and 5 in the array can be used.
//Both letters and numbers are permitted
System.out.print("5) 8 char string using specific characters in an array >>>");
char[] aChars = new char[] { 'a', '1', 'c', '2', 'e', 'f', 'g' };
System.out.println(RandomStringUtils.random(8, 0, 5, true, true, aChars));
}
}
4) 8 char string -Alphabets only >>>WOjFhopO
Download: CommonLangRandomStringUtils.random3.zip( 199 k)