Package com.github.ushiosan23.jvm.system
Class Rand
- java.lang.Object
-
- com.github.ushiosan23.jvm.system.Rand
-
public final class Rand extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static int[]RAND_ALL_SYMBOLSData range for all valid symbolsstatic int[]RAND_ALPHANUMERICData range for alphanumeric lettersstatic int[]RAND_LETTERSData range for all lettersstatic int[]RAND_NUMBERSData range for all numbers
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static @NotNull StringgetRandomString()Generate a random string with an adjustable size.static @NotNull StringgetRandomString(int size)Generate a random string with an adjustable size.static @NotNull StringgetRandomString(int size, int @NotNull [] charLimits)Generate a random string with an adjustable size.static RandomgetSystemRandom()Return a default system random object.static RandomgetSystemRandom(long seed)Return a default system random object
-
-
-
Field Detail
-
RAND_LETTERS
public static final int[] RAND_LETTERS
Data range for all letters
-
RAND_NUMBERS
public static final int[] RAND_NUMBERS
Data range for all numbers
-
RAND_ALPHANUMERIC
public static final int[] RAND_ALPHANUMERIC
Data range for alphanumeric letters
-
RAND_ALL_SYMBOLS
public static final int[] RAND_ALL_SYMBOLS
Data range for all valid symbols
-
-
Method Detail
-
getSystemRandom
public static Random getSystemRandom(long seed)
Return a default system random object- Parameters:
seed- Seed for the "Random" item. It is recommended to use the default seed and only apply it for test use.- Returns:
- Returns a default system random
- See Also:
getSystemRandom()
-
getSystemRandom
public static Random getSystemRandom()
Return a default system random object. This method applies the seed due to time. It is recommended for use in production.- Returns:
- Returns a default system random
-
getRandomString
@NotNull public static @NotNull String getRandomString(int size, int @NotNull [] charLimits)
Generate a random string with an adjustable size.- Parameters:
size- String sizecharLimits- Limit in which the characters will be generated.- Returns:
- Returns a random string
- See Also:
RAND_ALL_SYMBOLS,RAND_ALPHANUMERIC,RAND_LETTERS,RAND_NUMBERS
-
getRandomString
@NotNull public static @NotNull String getRandomString(int size)
Generate a random string with an adjustable size. By default, this method useRAND_ALL_SYMBOLSlimits- Parameters:
size- String size- Returns:
- Returns a random string
- See Also:
RAND_ALL_SYMBOLS,RAND_ALPHANUMERIC,RAND_LETTERS,RAND_NUMBERS
-
getRandomString
@NotNull public static @NotNull String getRandomString()
Generate a random string with an adjustable size. By default, this method useRAND_ALL_SYMBOLSlimits and size is 18- Returns:
- Returns a random string
- See Also:
RAND_ALL_SYMBOLS,RAND_ALPHANUMERIC,RAND_LETTERS,RAND_NUMBERS
-
-