Class RandomString
java.lang.Object
jodd.util.RandomString
Class that generates random strings.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final char[]protected static final char[]protected static final RandomStringprotected final SecureRandom -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic RandomStringget()Returns default instance ofRandomString.random(int count, char[] chars) Creates random string whose length is the number of characters specified.random(int count, char start, char end) Creates random string whose length is the number of characters specified.Creates random string whose length is the number of characters specified.randomAlpha(int count) Creates random string of characters.randomAlphaNumeric(int count) Creates random string of characters and digits.randomAscii(int count) Creates random string whose length is the number of characters specified.randomBase64(int count) Creates random string that contains only Base64 characters.randomNumeric(int count) Creates random string that consist only of numbers.randomRanges(int count, char... ranges) Creates random string whose length is the number of characters specified.
-
Field Details
-
ALPHA_RANGE
protected static final char[] ALPHA_RANGE -
ALPHA_NUMERIC_RANGE
protected static final char[] ALPHA_NUMERIC_RANGE -
INSTANCE
-
rnd
-
-
Constructor Details
-
RandomString
public RandomString()Creates new random string.
-
-
Method Details
-
get
Returns default instance ofRandomString. -
random
Creates random string whose length is the number of characters specified. Characters are chosen from the set of characters specified. -
random
-
random
Creates random string whose length is the number of characters specified. Characters are chosen from the provided range. -
randomAscii
Creates random string whose length is the number of characters specified. Characters are chosen from the set of characters whose ASCII value is between32and126(inclusive). -
randomNumeric
Creates random string that consist only of numbers. -
randomRanges
Creates random string whose length is the number of characters specified. Characters are chosen from the multiple sets defined by range pairs. All ranges must be in acceding order. -
randomAlpha
Creates random string of characters. -
randomAlphaNumeric
Creates random string of characters and digits. -
randomBase64
Creates random string that contains only Base64 characters.
-