类 SbcbflwRandomStringUtils

java.lang.Object
javabase.lorenwang.common_base_frame.utils.SbcbflwRandomStringUtils

public class SbcbflwRandomStringUtils
extends Object
  • 构造器概要

    构造器
    构造器 说明
    SbcbflwRandomStringUtils()
    RandomStringUtils instances should NOT be constructed in standard programming.
  • 方法概要

    修饰符和类型 方法 说明
    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[] chars)
    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[] chars)
    Creates a random string based on a variety of options, using default source of randomness.
    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.
    static String random​(int count, String chars)
    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.

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 构造器详细资料

    • SbcbflwRandomStringUtils

      public SbcbflwRandomStringUtils()

      RandomStringUtils instances should NOT be constructed in standard programming. Instead, the class should be used as RandomStringUtils.random(5);.

      This constructor is public to permit tools that require a JavaBean instance to operate.

  • 方法详细资料

    • random

      public static String random​(int count)

      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

      public static String randomAscii​(int count)

      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 32 and 126 (inclusive).

      参数:
      count - the length of random string to create
      返回:
      the random string
    • randomAlphabetic

      public static String randomAlphabetic​(int count)

      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

      public static String randomAlphanumeric​(int count)

      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

      public static String randomNumeric​(int count)

      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

      public static String random​(int count, boolean letters, boolean numbers)

      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 create
      letters - if true, generated string will include alphabetic characters
      numbers - if true, generated string will include numeric characters
      返回:
      the random string
    • random

      public 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.

      Characters will be chosen from the set of alpha-numeric characters as indicated by the arguments.

      参数:
      count - the length of random string to create
      start - the position in set of chars to start at
      end - the position in set of chars to end before
      letters - if true, generated string will include alphabetic characters
      numbers - if true, 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 static Random instance.

      参数:
      count - the length of random string to create
      start - the position in set of chars to start at
      end - the position in set of chars to end before
      letters - only allow letters?
      numbers - only allow numbers?
      chars - the set of chars to choose randoms from. If null, then it will use the set of all chars.
      返回:
      the random string
      抛出:
      ArrayIndexOutOfBoundsException - if there are not (end - start) + 1 characters 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 both false, in which case, start and end are set to 0 and Integer.MAX_VALUE.

      If set is not null, characters between start and end are chosen.

      This method accepts a user-supplied Random instance to use as a source of randomness. By seeding a single Random instance 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 create
      start - the position in set of chars to start at
      end - the position in set of chars to end before
      letters - only allow letters?
      numbers - only allow numbers?
      chars - the set of chars to choose randoms from. If null, then it will use the set of all chars.
      random - a source of randomness.
      返回:
      the random string
      抛出:
      ArrayIndexOutOfBoundsException - if there are not (end - start) + 1 characters in the set array.
      IllegalArgumentException - if count < 0.
      从以下版本开始:
      2.0
    • random

      public static String random​(int count, String chars)

      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 create
      chars - the String containing the set of characters to use, may be null
      返回:
      the random string
      抛出:
      IllegalArgumentException - if count < 0.
    • random

      public static String random​(int count, char[] chars)

      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 create
      chars - the character array containing the set of characters to use, may be null
      返回:
      the random string
      抛出:
      IllegalArgumentException - if count < 0.