|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.commons.lang.RandomStringUtils
Common random String
manipulation routines.
Originally from the GenerationJava Core library.
Field Summary | |
private static Random |
RANDOM
Random object used by random method. |
Constructor Summary | |
RandomStringUtils()
RandomStringUtils instances should NOT be constructed in standard programming. |
Method Summary | |
static String |
random(int count)
Creates a random string whose length is the number of characters specified. |
static String |
random(int count,
boolean letters,
boolean numbers)
Creates a random string whose length is the number of characters specified. |
static String |
random(int count,
char[] set)
Creates a random string whose length is the number of characters specified. |
static String |
random(int count,
int start,
int end,
boolean letters,
boolean numbers)
Creates a random string whose length is the number of characters specified. |
static String |
random(int count,
int start,
int end,
boolean letters,
boolean numbers,
char[] set)
Creates a random string based on a variety of options. |
static String |
random(int count,
String set)
Creates a random string whose length is the number of characters specified. |
static String |
randomAlphabetic(int count)
Creates a random string whose length is the number of characters specified. |
static String |
randomAlphanumeric(int count)
Creates a random string whose length is the number of characters specified. |
static String |
randomAscii(int count)
Creates a random string whose length is the number of characters specified. |
static String |
randomNumeric(int count)
Creates a random string whose length is the number of characters specified. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final Random RANDOM
Constructor Detail |
public RandomStringUtils()
RandomStringUtils.random(5);
.
This constructor is public to permit tools that require a JavaBean instance
to operate.
Method Detail |
public static String random(int count)
count
- length of random string to create
public static String randomAscii(int count)
count
- length of random string to create
public static String randomAlphabetic(int count)
count
- length of random string to create
public static String randomAlphanumeric(int count)
count
- length of random string to create
public static String randomNumeric(int count)
count
- length of random string to create
public static String random(int count, boolean letters, boolean numbers)
count
- length of random string to createletters
- if true
, generated string will include
alphabetic charactersnumbers
- if true
, generatd string will include
numeric characters
public static String random(int count, int start, int end, boolean letters, boolean numbers)
count
- length of random string to createstart
- int position in set of chars to start atend
- int position in set of chars to end beforeletters
- if true
, generated string will include
alphabetic charactersnumbers
- if true
, generatd string will include
numeric characters
public static String random(int count, int start, int end, boolean letters, boolean numbers, char[] set)
If set is not null, characters between start and end are chosen.
count
- int length of random string to createstart
- int position in set of chars to start atend
- int position in set of chars to end beforeletters
- boolean only allow letters?numbers
- boolean only allow numbers?set
- char[] set of chars to choose randoms from.
If null, then it will use the set of all chars.
ArrayIndexOutOfBoundsException
- if there are not (end - start) + 1
characters in the set array.public static String random(int count, String set)
count
- int length of random string to createset
- String containing the set of characters to use
public static String random(int count, char[] set)
count
- int length of random string to createset
- character array containing the set of characters to use
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |