Package org.pipservices3.commons.random
Class RandomText
java.lang.Object
org.pipservices3.commons.random.RandomText
Random generator for various text values like names, addresses or phone numbers.
### Example ###
String value1 = RandomText.name(); // Possible result: "Sergio"
String value2 = RandomText.verb(); // Possible result: "Run"
String value3 = RandomText.Text(50); // Possible result: "Run jorge. Red high scream?"
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Generates a random adjective.static String
color()
Generates a random color name.static String
email()
Generates a random email address.static String
fullName()
Generates a random person's name which has the following structure optional prefix - first name - second name - optional suffixstatic String
noun()
Generates a random noun.static String
phone()
Generates a random phone number.static String
phrase
(int size) Generates a random phrase which consists of few words separated by spaces.static String
phrase
(int minSize, int maxSize) Generates a random phrase which consists of few words separated by spaces.static String
text
(int minSize, int maxSize) Generates a random text, consisting of first names, last names, colors, stuffs, adjectives, verbs, and punctuation marks.static String
verb()
Generates a random verb.static String
word()
Generates a random word from available first names, last names, colors, stuffs, adjectives, or verbs.static String
words
(int min, int max) Generates a random text that consists of random number of random words separated by spaces.
-
Constructor Details
-
RandomText
public RandomText()
-
-
Method Details
-
color
Generates a random color name. The result value is capitalized.- Returns:
- a random color name.
-
noun
Generates a random noun. The result value is capitalized.- Returns:
- a random noun.
-
adjective
Generates a random adjective. The result value is capitalized.- Returns:
- a random adjective.
-
verb
Generates a random verb. The result value is capitalized.- Returns:
- a random verb.
-
phrase
Generates a random phrase which consists of few words separated by spaces. The first word is capitalized, others are not.- Parameters:
size
- the length of the phrase- Returns:
- a random phrase.
-
phrase
Generates a random phrase which consists of few words separated by spaces. The first word is capitalized, others are not.- Parameters:
minSize
- (optional) minimum string length.maxSize
- maximum string length.- Returns:
- a random phrase.
-
fullName
Generates a random person's name which has the following structure optional prefix - first name - second name - optional suffix- Returns:
- a random name.
-
word
Generates a random word from available first names, last names, colors, stuffs, adjectives, or verbs.- Returns:
- a random word.
-
words
Generates a random text that consists of random number of random words separated by spaces.- Parameters:
min
- (optional) a minimum number of words.max
- a maximum number of words.- Returns:
- a random text.
-
phone
Generates a random phone number. The phone number has the format: (XXX) XXX-YYYY- Returns:
- a random phone number.
-
email
Generates a random email address.- Returns:
- a random email address.
-
text
Generates a random text, consisting of first names, last names, colors, stuffs, adjectives, verbs, and punctuation marks.- Parameters:
minSize
- minimum amount of words to generate. Text will contain 'minSize' words if 'maxSize' is omitted.maxSize
- (optional) maximum amount of words to generate.- Returns:
- a random text.
-