public class RND
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ALL |
static char[] |
ALL_CHARS |
static java.lang.String |
ALL_ENG |
static char[] |
ALL_ENG_CHARS |
static java.lang.String |
DEG |
static java.lang.String |
eng |
static java.lang.String |
ENG |
static java.util.Random |
rnd |
static java.lang.String |
rus |
static java.lang.String |
RUS |
| Constructor and Description |
|---|
RND() |
| Modifier and Type | Method and Description |
|---|---|
static java.math.BigDecimal |
bd(long max,
int afterPoint)
Generates a random number of type
BigDecimal in the range |
static boolean |
bool()
Generates random Boolean value
|
static byte[] |
byteArray(int len)
Generates a random array with a length
len |
static java.util.Date |
dateDays(int fromDaysBeforeNow,
int toDayAfterNow)
Generates a random date in the range from
fromDaysBeforeNow days ago, to
toDayAfterNow days ago |
static java.util.Date |
dateYears(int yearFrom,
int yearTo)
Generates a random date in the range from
yearFrom years ago, to
yearTo years ago |
static <T> T |
from(T... values)
Selects random element from varargs array
|
static <T> T |
of(java.util.Collection<T> source)
Selects random element from list
|
static double |
plusDouble(double max,
int point)
Generates a random real positive number in the range
|
static int |
plusInt(int max)
Generates a random positive number of type
int in the range |
static long |
plusLong(long max)
Generates a random positive number of type
long in the range |
static <E extends java.lang.Enum<E>> |
someEnum(E... values)
Selects a random value from the values transmitted from enum
|
static java.lang.String |
str(int len)
Generates random string with a length of
len characters. |
static java.lang.String |
strEng(int len)
Generates random string with a length of
len characters. |
static java.lang.String |
strFrom(int len,
char[] availableChars)
Generates random string with a length of
len characters. |
static java.lang.String |
strInt(int len)
Generates a string consisting of random numbers
|
public static final java.lang.String rus
public static final java.lang.String RUS
public static final java.lang.String eng
public static final java.lang.String ENG
public static final java.lang.String DEG
public static final java.lang.String ALL
public static final char[] ALL_CHARS
public static final java.lang.String ALL_ENG
public static final char[] ALL_ENG_CHARS
public static final java.util.Random rnd
public static java.lang.String str(int len)
len characters. Characters are selected
randomly from the following array: Arabic numerals, Russian alphabet uppercase and lowercase,
English alphabet uppercase and lowercase.len - the length of generate stringpublic static java.lang.String strEng(int len)
len characters. Characters are selected
randomly from the following array: Arabic numerals, English alphabet uppercase and lowercase.len - the length of generate stringpublic static java.lang.String strFrom(int len,
char[] availableChars)
len characters. Characters are selected
randomly from the array availableCharslen - the length of generate stringavailableChars - the source of characters for generation string.public static java.lang.String strInt(int len)
len - the length of generate stringpublic static long plusLong(long max)
Generates a random positive number of type long in the range
0 <= x < max
max - the maximum value of the generate numberpublic static int plusInt(int max)
Generates a random positive number of type int in the range
0 <= x < max
max - the maximum value of the generate numberpublic static java.util.Date dateYears(int yearFrom,
int yearTo)
yearFrom years ago, to
yearTo years agoyearFrom - as many years ago - range start in which date is generatedyearTo - as many years ago - range end in which date is generatedpublic static java.util.Date dateDays(int fromDaysBeforeNow,
int toDayAfterNow)
fromDaysBeforeNow days ago, to
toDayAfterNow days agofromDaysBeforeNow - as many days ago - range start in which date is generatedtoDayAfterNow - as many days ago - range end in which date is generatedpublic static byte[] byteArray(int len)
lenlen - the length of generate arraypublic static boolean bool()
@SafeVarargs public static <E extends java.lang.Enum<E>> E someEnum(E... values)
values - enum values@SafeVarargs public static <T> T from(T... values)
T - any returning typevalues - varargs source arraypublic static <T> T of(java.util.Collection<T> source)
T - any returning typesource - source listpublic static double plusDouble(double max,
int point)
Generates a random real positive number in the range
0 <= x < max
max - the upper limit of the selected valuespoint - the number of decimal placespublic static java.math.BigDecimal bd(long max,
int afterPoint)
Generates a random number of type BigDecimal in the range
0 <= x < max
max - the upper limit of generate numberafterPoint - the number of decimal places