RandomStringUtils: random(int count, String chars) : RandomStringUtils « org.apache.commons.lang « Java by API






RandomStringUtils: random(int count, String chars)

/*
 1) 8 char string using chars ABCDEF >>>FDBDFADE
 */
import org.apache.commons.lang.RandomStringUtils;

public class RandomStringUtilsTrial {
    public static void main(String[] args) {
        //Random 8 chars string from within the characters ABCDEF
        System.out.print("1) 8 char string using chars ABCDEF >>>");
        System.out.println(RandomStringUtils.random(8, "ABCDEF"));
    }
}

           
       








Apache-Common-Lang.zip( 248 k)

Related examples in the same category

1.RandomStringUtils: random(int count, boolean letters, boolean numbers)
2.RandomStringUtils: random(int count, int start, int end, boolean letters, boolean numbers, char[] chars, Random random)
3.RandomStringUtils: randomAlphabetic(int count)
4.RandomStringUtils: randomNumeric(int count)