类 SbcbflwRandomStringUtils
public class SbcbflwRandomStringUtils extends Object
-
构造器概要
构造器 构造器 说明 SbcbflwRandomStringUtils()RandomStringUtilsinstances should NOT be constructed in standard programming. -
方法概要
修饰符和类型 方法 说明 static Stringrandom(int count)Creates a random string whose length is the number of characters specified.static Stringrandom(int count, boolean letters, boolean numbers)Creates a random string whose length is the number of characters specified.static Stringrandom(int count, char[] chars)Creates a random string whose length is the number of characters specified.static Stringrandom(int count, int start, int end, boolean letters, boolean numbers)Creates a random string whose length is the number of characters specified.static Stringrandom(int count, int start, int end, boolean letters, boolean numbers, char[] chars)Creates a random string based on a variety of options, using default source of randomness.static Stringrandom(int count, int start, int end, boolean letters, boolean numbers, char[] chars, Random random)Creates a random string based on a variety of options, using supplied source of randomness.static Stringrandom(int count, String chars)Creates a random string whose length is the number of characters specified.static StringrandomAlphabetic(int count)Creates a random string whose length is the number of characters specified.static StringrandomAlphanumeric(int count)Creates a random string whose length is the number of characters specified.static StringrandomAscii(int count)Creates a random string whose length is the number of characters specified.static StringrandomNumeric(int count)Creates a random string whose length is the number of characters specified.
-
构造器详细资料
-
SbcbflwRandomStringUtils
public SbcbflwRandomStringUtils()RandomStringUtilsinstances should NOT be constructed in standard programming. Instead, the class should be used asRandomStringUtils.random(5);.This constructor is public to permit tools that require a JavaBean instance to operate.
-
-
方法详细资料
-
random
Creates a random string whose length is the number of characters specified.
Characters will be chosen from the set of all characters.
- 参数:
count- the length of random string to create- 返回:
- the random string
-
randomAscii
Creates a random string whose length is the number of characters specified.
Characters will be chosen from the set of characters whose ASCII value is between
32and126(inclusive).- 参数:
count- the length of random string to create- 返回:
- the random string
-
randomAlphabetic
Creates a random string whose length is the number of characters specified.
Characters will be chosen from the set of alphabetic characters.
- 参数:
count- the length of random string to create- 返回:
- the random string
-
randomAlphanumeric
Creates a random string whose length is the number of characters specified.
Characters will be chosen from the set of alpha-numeric characters.
- 参数:
count- the length of random string to create- 返回:
- the random string
-
randomNumeric
Creates a random string whose length is the number of characters specified.
Characters will be chosen from the set of numeric characters.
- 参数:
count- the length of random string to create- 返回:
- the random string
-
random
Creates a random string whose length is the number of characters specified.
Characters will be chosen from the set of alpha-numeric characters as indicated by the arguments.
- 参数:
count- the length of random string to createletters- iftrue, generated string will include alphabetic charactersnumbers- iftrue, generated string will include numeric characters- 返回:
- the random string
-
random
Creates a random string whose length is the number of characters specified.
Characters will be chosen from the set of alpha-numeric characters as indicated by the arguments.
- 参数:
count- the length of random string to createstart- the position in set of chars to start atend- the position in set of chars to end beforeletters- iftrue, generated string will include alphabetic charactersnumbers- iftrue, generated string will include numeric characters- 返回:
- the random string
-
random
public static String random(int count, int start, int end, boolean letters, boolean numbers, char[] chars)Creates a random string based on a variety of options, using default source of randomness.
This method has exactly the same semantics as
random(int,int,int,boolean,boolean,char[],Random), but instead of using an externally supplied source of randomness, it uses the internal staticRandominstance.- 参数:
count- the length of random string to createstart- the position in set of chars to start atend- the position in set of chars to end beforeletters- only allow letters?numbers- only allow numbers?chars- the set of chars to choose randoms from. Ifnull, then it will use the set of all chars.- 返回:
- the random string
- 抛出:
ArrayIndexOutOfBoundsException- if there are not(end - start) + 1characters in the set array.
-
random
public static String random(int count, int start, int end, boolean letters, boolean numbers, char[] chars, Random random)Creates a random string based on a variety of options, using supplied source of randomness.
If start and end are both
0, start and end are set to' 'and'z', the ASCII printable characters, will be used, unless letters and numbers are bothfalse, in which case, start and end are set to0andInteger.MAX_VALUE.If set is not
null, characters between start and end are chosen.This method accepts a user-supplied
Randominstance to use as a source of randomness. By seeding a singleRandominstance with a fixed seed and using it for each call, the same random sequence of strings can be generated repeatedly and predictably.- 参数:
count- the length of random string to createstart- the position in set of chars to start atend- the position in set of chars to end beforeletters- only allow letters?numbers- only allow numbers?chars- the set of chars to choose randoms from. Ifnull, then it will use the set of all chars.random- a source of randomness.- 返回:
- the random string
- 抛出:
ArrayIndexOutOfBoundsException- if there are not(end - start) + 1characters in the set array.IllegalArgumentException- ifcount< 0.- 从以下版本开始:
- 2.0
-
random
Creates a random string whose length is the number of characters specified.
Characters will be chosen from the set of characters specified.
- 参数:
count- the length of random string to createchars- the String containing the set of characters to use, may be null- 返回:
- the random string
- 抛出:
IllegalArgumentException- ifcount< 0.
-
random
Creates a random string whose length is the number of characters specified.
Characters will be chosen from the set of characters specified.
- 参数:
count- the length of random string to createchars- the character array containing the set of characters to use, may be null- 返回:
- the random string
- 抛出:
IllegalArgumentException- ifcount< 0.
-