Pip-Services-Commons-Dotnet
Static Public Member Functions | Static Private Attributes | List of all members
PipServices3.Commons.Random.RandomText Class Reference

Random generator for various text values like names, addresses or phone numbers. More...

Static Public Member Functions

static string Color ()
 Generates a random color name. The result value is capitalized. More...
 
static string Stuff ()
 Generates a random noun. The result value is capitalized. More...
 
static string Adjective ()
 Generates a random adjective. The result value is capitalized. More...
 
static string Verb ()
 Generates a random verb. The result value is capitalized. More...
 
static string Phrase (int size)
 Generates a random phrase which consists of few words separated by spaces. The first word is capitalized, others are not. More...
 
static string Phrase (int minSize, int maxSize)
 Generates a random phrase which consists of few words separated by spaces. The first word is capitalized, others are not. More...
 
static string Name ()
 Generates a random person's name which has the following structure optional prefix - first name - second name - optional suffix More...
 
static string Word ()
 Generates a random word from available first names, last names, colors, stuffs, adjectives, or verbs. More...
 
static string Words (int min, int max)
 Generates a random text that consists of random number of random words separated by spaces. More...
 
static string Phone ()
 Generates a random phone number. The phone number has the format: (XXX) XXX-YYYY More...
 
static string Email ()
 Generates a random email address. More...
 
static string Text (int size)
 Generates a random text, consisting of first names, last names, colors, stuffs, adjectives, verbs, and punctuation marks. More...
 
static string Text (int minSize, int maxSize)
 Generates a random text, consisting of first names, last names, colors, stuffs, adjectives, verbs, and punctuation marks. More...
 

Static Private Attributes

static readonly string [] _namePrefixes = new string[] { "Dr.", "Mr.", "Mrs" }
 
static readonly string [] _nameSuffixes = new string[] { "Jr.", "Sr.", "II", "III" }
 
static readonly string [] _firstNames
 
static readonly string [] _lastNames
 
static readonly string [] _colors
 
static readonly string [] _stuffs
 
static readonly string [] _adjectives
 
static readonly string [] _verbs
 
static readonly string [] _allWords
 

Detailed Description

Random generator for various text values like names, addresses or phone numbers.

var value1 = RandomText.Name(); // Possible result: "Sergio"
var value2 = RandomText.Verb(); // Possible result: "Run"
var value3 = RandomText.Text(50); // Possible result: "Run jorge. Red high scream?"

Member Function Documentation

◆ Adjective()

static string PipServices3.Commons.Random.RandomText.Adjective ( )
static

Generates a random adjective. The result value is capitalized.

Returns
a random adjective.

◆ Color()

static string PipServices3.Commons.Random.RandomText.Color ( )
static

Generates a random color name. The result value is capitalized.

Returns
a random color name.

◆ Email()

static string PipServices3.Commons.Random.RandomText.Email ( )
static

Generates a random email address.

Returns
a random email address.

◆ Name()

static string PipServices3.Commons.Random.RandomText.Name ( )
static

Generates a random person's name which has the following structure optional prefix - first name - second name - optional suffix

Returns
a random name.

◆ Phone()

static string PipServices3.Commons.Random.RandomText.Phone ( )
static

Generates a random phone number. The phone number has the format: (XXX) XXX-YYYY

Returns
a random phone number.

◆ Phrase() [1/2]

static string PipServices3.Commons.Random.RandomText.Phrase ( int  size)
static

Generates a random phrase which consists of few words separated by spaces. The first word is capitalized, others are not.

Parameters
sizethe size of phrase
Returns
a random phrase.

◆ Phrase() [2/2]

static string PipServices3.Commons.Random.RandomText.Phrase ( int  minSize,
int  maxSize 
)
static

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.
maxSizemaximum string length.
Returns
a random phrase.

◆ Stuff()

static string PipServices3.Commons.Random.RandomText.Stuff ( )
static

Generates a random noun. The result value is capitalized.

Returns
a random noun.

◆ Text() [1/2]

static string PipServices3.Commons.Random.RandomText.Text ( int  size)
static

Generates a random text, consisting of first names, last names, colors, stuffs, adjectives, verbs, and punctuation marks.

Parameters
sizethe size of text.
Returns
a random text.

◆ Text() [2/2]

static string PipServices3.Commons.Random.RandomText.Text ( int  minSize,
int  maxSize 
)
static

Generates a random text, consisting of first names, last names, colors, stuffs, adjectives, verbs, and punctuation marks.

Parameters
minSizeminimum 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.

◆ Verb()

static string PipServices3.Commons.Random.RandomText.Verb ( )
static

Generates a random verb. The result value is capitalized.

Returns
a random verb.

◆ Word()

static string PipServices3.Commons.Random.RandomText.Word ( )
static

Generates a random word from available first names, last names, colors, stuffs, adjectives, or verbs.

Returns
a random word.

◆ Words()

static string PipServices3.Commons.Random.RandomText.Words ( int  min,
int  max 
)
static

Generates a random text that consists of random number of random words separated by spaces.

Parameters
min(optional) a minimum number of words.
maxa maximum number of words.
Returns
a random text.

Member Data Documentation

◆ _adjectives

readonly string [] PipServices3.Commons.Random.RandomText._adjectives
staticprivate
Initial value:
= new string[] {
"Large", "Small", "High", "Low", "Certain", "Fuzzy", "Modern", "Faster", "Slower"
}

◆ _allWords

readonly string [] PipServices3.Commons.Random.RandomText._allWords
staticprivate
Initial value:
= _firstNames.Concat(_lastNames).Concat(_colors).Concat(_stuffs).Concat(_adjectives)
.Concat(_verbs).ToArray()

◆ _colors

readonly string [] PipServices3.Commons.Random.RandomText._colors
staticprivate
Initial value:
= new string[] {
"Black", "White", "Red", "Blue", "Green", "Yellow", "Purple", "Grey", "Magenta", "Cian"
}

◆ _firstNames

readonly string [] PipServices3.Commons.Random.RandomText._firstNames
staticprivate
Initial value:
= new string[] {
"John", "Bill", "Andrew", "Nick", "Pamela", "Bela", "Sergio", "George", "Hurry", "Cecilia", "Vesta", "Terry", "Patrick"
}

◆ _lastNames

readonly string [] PipServices3.Commons.Random.RandomText._lastNames
staticprivate
Initial value:
= new string[] {
"Doe", "Smith", "Johns", "Gates", "Carmack", "Zontak", "Clinton", "Adams", "First", "Lopez", "Due", "White", "Black"
}

◆ _stuffs

readonly string [] PipServices3.Commons.Random.RandomText._stuffs
staticprivate
Initial value:
= new string[] {
"Game", "Ball", "Home", "Board", "Car", "Plane", "Hotel", "Wine", "Pants", "Boots", "Table", "Chair"
}

◆ _verbs

readonly string [] PipServices3.Commons.Random.RandomText._verbs
staticprivate
Initial value:
= new string[] {
"Run", "Stay", "Breeze", "Fly", "Lay", "Write", "Draw", "Scream"
}

The documentation for this class was generated from the following file: