|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.marketcetera.util.misc.RandomStrings
public final class RandomStrings
Utilities for random string generation. All random distributions are uniform.
| Field Summary | |
|---|---|
static int |
DEFAULT_LEN_STR_ALNUM
The default maximum length of a randomly generated string whose characters are all Unicode code points that are letters or digits; the minimum length is 1. |
static int |
DEFAULT_LEN_STR_CHARSET
The default maximum length of a randomly generated string whose characters are all Unicode code points that can be encoded by some charset (supplied or implied); the minimum length is 1. |
static int |
DEFAULT_LEN_STR_DIGIT
The default maximum length of a randomly generated string whose characters are all Unicode code points that are digits; the minimum length is 1. |
static int |
DEFAULT_LEN_STR_ID
The default maximum length of a randomly generated string whose characters are all Unicode code points; in addition, the first character is always a letter, the second is always a digit, and the rest (if any) are either letters or digits; the minimum length is 2. |
static int |
DEFAULT_LEN_STR_LETTER
The default maximum length of a randomly generated string whose characters are all Unicode code points that are letters; the minimum length is 1. |
static int |
DEFAULT_LEN_STR_VALID
The default maximum length of a randomly generated string whose characters are all Unicode code points that are deemed valid by StringUtils.isValid(int); the minimum length is 1. |
| Method Summary | |
|---|---|
static String |
genStr(UCPFilter filter,
int len)
Returns a generated string of the given length whose characters are all Unicode code points that meet the constraints of the given filter. |
static String |
genStrAlNum()
Returns a randomly generated string of random length (bound by DEFAULT_LEN_STR_ALNUM) whose characters are all
Unicode code points that are letters or digits. |
static String |
genStrAlNum(int len)
Returns a randomly generated string of the given length whose characters are all Unicode code points that are letters or digits. |
static String |
genStrCharset(Charset cs)
Returns a randomly generated string of random length (bound by DEFAULT_LEN_STR_CHARSET) whose characters are all
Unicode code points that can be encoded by the given charset. |
static String |
genStrCharset(Charset cs,
int len)
Returns a randomly generated string of the given length whose characters are all Unicode code points that can be encoded by the given charset. |
static String |
genStrDefCharset()
Returns a randomly generated string of random length (bound by DEFAULT_LEN_STR_CHARSET) whose characters are all
Unicode code points that can be encoded by the default JVM
charset. |
static String |
genStrDefCharset(int len)
Returns a randomly generated string of the given length whose characters are all Unicode code points that can be encoded by the default JVM charset. |
static String |
genStrDigit()
Returns a randomly generated string of random length (bound by DEFAULT_LEN_STR_DIGIT) whose characters are all
Unicode code points that are digits. |
static String |
genStrDigit(int len)
Returns a randomly generated string of the given length whose characters are all Unicode code points that are digits. |
static String |
genStrFileSystem()
Returns a randomly generated string of random length (bound by DEFAULT_LEN_STR_CHARSET) whose characters are all
Unicode code points that can be encoded by the current system
file encoding/charset (as specified in the system property
file.encoding). |
static String |
genStrFileSystem(int len)
Returns a randomly generated string of the given length whose characters are all Unicode code points that can be encoded by the current system file encoding/charset (as specified in the system property file.encoding). |
static String |
genStrId()
Returns a randomly generated string of random length (bound by DEFAULT_LEN_STR_ID) whose characters are all Unicode
code points; in addition, the first character is always a
letter, the second is always a digit, and the rest (if any) are
either letters or digits. |
static String |
genStrId(int len)
Returns a randomly generated string of the given length whose characters are all Unicode code points; in addition, the first character (if any) is always a letter, the second (if any) is always a digit, and the rest (if any) are either letters or digits. |
static String |
genStrLetter()
Returns a randomly generated string of random length (bound by DEFAULT_LEN_STR_LETTER) whose characters are all
Unicode code points that are letters. |
static String |
genStrLetter(int len)
Returns a randomly generated string of the given length whose characters are all Unicode code points that are letters. |
static String |
genStrValid()
Returns a randomly generated string of random length (bound by DEFAULT_LEN_STR_VALID) whose characters are all
Unicode code points that are deemed valid by StringUtils.isValid(int). |
static String |
genStrValid(int len)
Returns a randomly generated string of the given length whose characters are all Unicode code points that are deemed valid by StringUtils.isValid(int). |
static int |
genUCP()
Returns a randomly generated Unicode code point within the full range of valid Unicode scalar values. |
static int |
genUCP(UCPFilter filter)
Returns a randomly generated Unicode code point that meets the constraints of the given filter. |
static int |
genUCPAlNum()
Returns a randomly generated Unicode code point that is either a letter or a digit. |
static int |
genUCPCharset(Charset cs)
Returns a randomly generated Unicode code point that can be encoded by the given charset. |
static int |
genUCPDefCharset()
Returns a randomly generated Unicode code point that can be encoded by the default JVM charset. |
static int |
genUCPDigit()
Returns a randomly generated Unicode code point that is a digit. |
static int |
genUCPFileSystem()
Returns a randomly generated Unicode code point that can be encoded by the current system file encoding/charset (as specified in the system property file.encoding). |
static int |
genUCPLetter()
Returns a randomly generated Unicode code point that is a letter. |
static int |
genUCPValid()
Returns a randomly generated Unicode code point that is deemed valid by StringUtils.isValid(int). |
static void |
resetGeneratorFixed()
Resets the random number generator used by this class to a fixed seed value, which henceforth results in a repeatable, deterministic sequence of random code points and strings. |
static long |
resetGeneratorRandom()
Resets the random number generator used by this class to a random seed value, and returns that value. |
static void |
resetGeneratorRandom(long seed)
Resets the random number generator used by this class to the given seed value, which henceforth results in a repeatable, deterministic sequence of random code points and strings. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_LEN_STR_CHARSET
public static final int DEFAULT_LEN_STR_VALID
StringUtils.isValid(int); the minimum length is 1.
public static final int DEFAULT_LEN_STR_DIGIT
public static final int DEFAULT_LEN_STR_LETTER
public static final int DEFAULT_LEN_STR_ALNUM
public static final int DEFAULT_LEN_STR_ID
| Method Detail |
|---|
public static void resetGeneratorRandom(long seed)
seed - The seed.public static long resetGeneratorRandom()
public static void resetGeneratorFixed()
public static int genUCP()
public static int genUCP(UCPFilter filter)
filter - The filter.
public static int genUCPCharset(Charset cs)
cs - The charset.
public static int genUCPDefCharset()
public static int genUCPFileSystem()
file.encoding).
public static int genUCPValid()
StringUtils.isValid(int).
public static int genUCPDigit()
public static int genUCPLetter()
public static int genUCPAlNum()
public static String genStr(UCPFilter filter,
int len)
filter - The filter.len - The length (in code points).
public static String genStrCharset(Charset cs,
int len)
cs - The charset.len - The length (in code points).
public static String genStrDefCharset(int len)
len - The length (in code points).
public static String genStrFileSystem(int len)
file.encoding).
len - The length (in code points).
public static String genStrValid(int len)
StringUtils.isValid(int).
len - The length (in code points).
public static String genStrDigit(int len)
len - The length (in code points).
public static String genStrLetter(int len)
len - The length (in code points).
public static String genStrAlNum(int len)
len - The length (in code points).
public static String genStrId(int len)
len - The length (in code points).
public static String genStrCharset(Charset cs)
DEFAULT_LEN_STR_CHARSET) whose characters are all
Unicode code points that can be encoded by the given charset.
cs - The charset.
public static String genStrDefCharset()
DEFAULT_LEN_STR_CHARSET) whose characters are all
Unicode code points that can be encoded by the default JVM
charset.
public static String genStrFileSystem()
DEFAULT_LEN_STR_CHARSET) whose characters are all
Unicode code points that can be encoded by the current system
file encoding/charset (as specified in the system property
file.encoding).
public static String genStrValid()
DEFAULT_LEN_STR_VALID) whose characters are all
Unicode code points that are deemed valid by StringUtils.isValid(int).
public static String genStrDigit()
DEFAULT_LEN_STR_DIGIT) whose characters are all
Unicode code points that are digits.
public static String genStrLetter()
DEFAULT_LEN_STR_LETTER) whose characters are all
Unicode code points that are letters.
public static String genStrAlNum()
DEFAULT_LEN_STR_ALNUM) whose characters are all
Unicode code points that are letters or digits.
public static String genStrId()
DEFAULT_LEN_STR_ID) whose characters are all Unicode
code points; in addition, the first character is always a
letter, the second is always a digit, and the rest (if any) are
either letters or digits.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||