Mock
public static class MockSwitch-style dispatcher from MockMagic.SimpleDataType to the matching generator. Lives in its own partial so the core file stays focused on the raw generators.
Methods
Section titled “Methods”
RegisterToken(string, Func)
Section titled “RegisterToken(string, Func)”public static void RegisterToken(string name, Func<string> factory)Register (or replace) a string-returning generator. The same name becomes usable as
a {{name}} token inside MockMagic.Mock.Parse(System.String).
Parameters
| Name | Type |
|---|---|
name |
System.String |
factory |
System.Func{System.String} |
RegisterGenerator(string, Func)
Section titled “RegisterGenerator(string, Func)”public static void RegisterGenerator<T>(string name, Func<T> factory)Register a typed generator. Works for any T. If T
is System.String the generator also becomes a MockMagic.Mock.Parse(System.String) token.
Parameters
| Name | Type |
|---|---|
name |
System.String |
factory |
System.Func{{T}} |
Get(string)
Section titled “Get(string)”public static T Get<T>(string name)Resolve a previously registered typed generator. Throws if no generator was registered
for the T/name combination.
Parameters
| Name | Type |
|---|---|
name |
System.String |
Returns
{T}
UnregisterToken(string)
Section titled “UnregisterToken(string)”public static bool UnregisterToken(string name)Remove a previously registered token/generator. Built-in tokens can also be removed this way if you want to override them with a newly registered one.
Parameters
| Name | Type |
|---|---|
name |
System.String |
Returns
System.Boolean
HasToken(string)
Section titled “HasToken(string)”public static bool HasToken(string name)Check whether a token has been registered.
Parameters
| Name | Type |
|---|---|
name |
System.String |
Returns
System.Boolean
Parse(string)
Section titled “Parse(string)”public static string Parse(string template)Replace every {{tokenName}} in template with the current
output of the matching registered generator. Unknown tokens are left as-is so they
can be easily spotted during debugging.
Parameters
| Name | Type |
|---|---|
template |
System.String |
Returns
System.String
Examples
Mock.Parse(“{{firstName}} <{{email}}> id={{unique}}”)
Parse(string, int)
Section titled “Parse(string, int)”public static string[] Parse(string template, int count)Parse template repeatedly, returning one string per iteration.
Parameters
| Name | Type |
|---|---|
template |
System.String |
count |
System.Int32 |
Returns
System.String[]
HackerAdjective()
Section titled “HackerAdjective()”public static string HackerAdjective()Random tech-flavoured adjective, e.g. “cross-platform”.
Returns
System.String
HackerNoun()
Section titled “HackerNoun()”public static string HackerNoun()Random tech-flavoured noun, e.g. “firewall”.
Returns
System.String
HackerVerb()
Section titled “HackerVerb()”public static string HackerVerb()Random tech-flavoured verb (imperative), e.g. “bypass”.
Returns
System.String
HackerIngVerb()
Section titled “HackerIngVerb()”public static string HackerIngVerb()Random tech-flavoured verb in -ing form, e.g. “bypassing”.
Returns
System.String
HackerPhrase()
Section titled “HackerPhrase()”public static string HackerPhrase()Assemble a phrase like “try parsing the SSL sensor, maybe it will reboot the digital bus!”.
Returns
System.String
Guid()
Section titled “Guid()”public static string Guid()Generate a random GUID string. When a seed is active the GUID is produced from
MockMagic.MockRandom so the output is reproducible; otherwise the runtime’s
System.Guid.NewGuid is used for uniqueness guarantees.
Returns
System.String
Guids(int)
Section titled “Guids(int)”public static string[] Guids(int count)Generate multiple random GUIDs.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
public static int Id()Generate a sequential ID using the shared MockMagic.MockRandom.UniqueIndex.
Returns
System.Int32
Ids(int)
Section titled “Ids(int)”public static int[] Ids(int count)Generate multiple sequential IDs.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.Int32[]
ResetIdCounter(int)
Section titled “ResetIdCounter(int)”public static void ResetIdCounter(int startValue = 1)Reset the ID counter (and the shared unique-index counter) to the default start.
Parameters
| Name | Type |
|---|---|
startValue |
System.Int32 |
UseDateReference(DateTime?)
Section titled “UseDateReference(DateTime?)”public static void UseDateReference(DateTime? reference)Set a fixed reference date for date/time generators. Pass null to restore wall-clock behaviour.
Parameters
| Name | Type |
|---|---|
reference |
System.Nullable{System.DateTime} |
UseDateReference(Func)
Section titled “UseDateReference(Func)”public static void UseDateReference(Func<DateTime> provider)Set a dynamic reference-date provider for date/time generators.
Parameters
| Name | Type |
|---|---|
provider |
System.Func{System.DateTime} |
Timestamp()
Section titled “Timestamp()”public static long Timestamp()Generate a Unix timestamp (reference time with random offset of up to a year in each direction).
Returns
System.Int64
Timestamps(int)
Section titled “Timestamps(int)”public static long[] Timestamps(int count)Generate multiple timestamps.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.Int64[]
Date(int, int)
Section titled “Date(int, int)”public static string Date(int yearsBack = 5, int yearsForward = 1)Generate a random date string.
Parameters
| Name | Type |
|---|---|
yearsBack |
System.Int32 |
yearsForward |
System.Int32 |
Returns
System.String
Dates(int, int, int)
Section titled “Dates(int, int, int)”public static string[] Dates(int count, int yearsBack = 5, int yearsForward = 1)Generate multiple random dates.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
yearsBack |
System.Int32 |
yearsForward |
System.Int32 |
Returns
System.String[]
Time()
Section titled “Time()”public static string Time()Generate a random time string (HH:mm:ss).
Returns
System.String
Times(int)
Section titled “Times(int)”public static string[] Times(int count)Generate multiple random times.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
DateTime(int, int)
Section titled “DateTime(int, int)”public static string DateTime(int yearsBack = 5, int yearsForward = 1)Generate a random datetime string.
Parameters
| Name | Type |
|---|---|
yearsBack |
System.Int32 |
yearsForward |
System.Int32 |
Returns
System.String
DateTimes(int, int, int)
Section titled “DateTimes(int, int, int)”public static string[] DateTimes(int count, int yearsBack = 5, int yearsForward = 1)Generate multiple random datetimes.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
yearsBack |
System.Int32 |
yearsForward |
System.Int32 |
Returns
System.String[]
Name()
Section titled “Name()”public static string Name()Generate a random full name.
Returns
System.String
Names(int)
Section titled “Names(int)”public static string[] Names(int count)Generate multiple random names.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
FirstName()
Section titled “FirstName()”public static string FirstName()Generate a random first name.
Returns
System.String
FirstNames(int)
Section titled “FirstNames(int)”public static string[] FirstNames(int count)Generate multiple random first names.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
LastName()
Section titled “LastName()”public static string LastName()Generate a random last name.
Returns
System.String
LastNames(int)
Section titled “LastNames(int)”public static string[] LastNames(int count)Generate multiple random last names.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
Email()
Section titled “Email()”public static string Email()Generate a random email address.
Returns
System.String
Emails(int)
Section titled “Emails(int)”public static string[] Emails(int count)Generate multiple random emails.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
Phone()
Section titled “Phone()”public static string Phone()Generate a random phone number in the shape +1 (###) ###-####.
Returns
System.String
Phones(int)
Section titled “Phones(int)”public static string[] Phones(int count)Generate multiple random phone numbers.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
Address()
Section titled “Address()”public static string Address()Generate a random street address.
Returns
System.String
Addresses(int)
Section titled “Addresses(int)”public static string[] Addresses(int count)Generate multiple random addresses.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
City()
Section titled “City()”public static string City()Generate a random city name.
Returns
System.String
Cities(int)
Section titled “Cities(int)”public static string[] Cities(int count)Generate multiple random cities.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
Country()
Section titled “Country()”public static string Country()Generate a random country name.
Returns
System.String
Countries(int)
Section titled “Countries(int)”public static string[] Countries(int count)Generate multiple random countries.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
ZipCode()
Section titled “ZipCode()”public static string ZipCode()Generate a random 5-digit ZIP code.
Returns
System.String
ZipCodes(int)
Section titled “ZipCodes(int)”public static string[] ZipCodes(int count)Generate multiple random ZIP codes.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
Company()
Section titled “Company()”public static string Company()Generate a random company name.
Returns
System.String
Companies(int)
Section titled “Companies(int)”public static string[] Companies(int count)Generate multiple random company names.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
JobTitle()
Section titled “JobTitle()”public static string JobTitle()Generate a random job title.
Returns
System.String
JobTitles(int)
Section titled “JobTitles(int)”public static string[] JobTitles(int count)Generate multiple random job titles.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
LoremIpsum(int)
Section titled “LoremIpsum(int)”public static string LoremIpsum(int wordCount = 50)Generate lorem ipsum text.
Parameters
| Name | Type |
|---|---|
wordCount |
System.Int32 |
Returns
System.String
Word()
Section titled “Word()”public static string Word()Generate a random word.
Returns
System.String
Words(int)
Section titled “Words(int)”public static string[] Words(int count)Generate multiple random words.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
Sentence(int, int)
Section titled “Sentence(int, int)”public static string Sentence(int minWords = 5, int maxWords = 15)Generate a random sentence.
Parameters
| Name | Type |
|---|---|
minWords |
System.Int32 |
maxWords |
System.Int32 |
Returns
System.String
Sentences(int, int, int)
Section titled “Sentences(int, int, int)”public static string[] Sentences(int count, int minWords = 5, int maxWords = 15)Generate multiple random sentences.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
minWords |
System.Int32 |
maxWords |
System.Int32 |
Returns
System.String[]
Paragraph(int)
Section titled “Paragraph(int)”public static string Paragraph(int sentenceCount = 5)Generate a random paragraph.
Parameters
| Name | Type |
|---|---|
sentenceCount |
System.Int32 |
Returns
System.String
Paragraphs(int, int)
Section titled “Paragraphs(int, int)”public static string[] Paragraphs(int count, int sentenceCount = 5)Generate multiple random paragraphs.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
sentenceCount |
System.Int32 |
Returns
System.String[]
Color()
Section titled “Color()”public static Color Color()Generate a random Unity Color.
Returns
UnityEngine.Color
Colors(int)
Section titled “Colors(int)”public static Color[] Colors(int count)Generate multiple random colors.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
UnityEngine.Color[]
ColorName()
Section titled “ColorName()”public static string ColorName()Generate a random color name.
Returns
System.String
ColorNames(int)
Section titled “ColorNames(int)”public static string[] ColorNames(int count)Generate multiple random color names.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
HexColor()
Section titled “HexColor()”public static string HexColor()Generate a random hex color string.
Returns
System.String
HexColors(int)
Section titled “HexColors(int)”public static string[] HexColors(int count)Generate multiple random hex colors.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
Coordinate()
Section titled “Coordinate()”public static Vector2 Coordinate()Generate a random coordinate (lat, lon).
Returns
UnityEngine.Vector2
Coordinates(int)
Section titled “Coordinates(int)”public static Vector2[] Coordinates(int count)Generate multiple random coordinates.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
UnityEngine.Vector2[]
Latitude()
Section titled “Latitude()”public static float Latitude()Generate a random latitude.
Returns
System.Single
Longitude()
Section titled “Longitude()”public static float Longitude()Generate a random longitude.
Returns
System.Single
Currency(decimal, decimal)
Section titled “Currency(decimal, decimal)”public static decimal Currency(decimal min = 0, decimal max = 10000)Generate a random currency amount.
Parameters
| Name | Type |
|---|---|
min |
System.Decimal |
max |
System.Decimal |
Returns
System.Decimal
Currencies(int, decimal, decimal)
Section titled “Currencies(int, decimal, decimal)”public static decimal[] Currencies(int count, decimal min = 0, decimal max = 10000)Generate multiple random currency amounts.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
min |
System.Decimal |
max |
System.Decimal |
Returns
System.Decimal[]
Percentage()
Section titled “Percentage()”public static float Percentage()Generate a random percentage (0-100).
Returns
System.Single
Percentages(int)
Section titled “Percentages(int)”public static float[] Percentages(int count)Generate multiple random percentages.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.Single[]
Boolean()
Section titled “Boolean()”public static bool Boolean()Generate a random boolean.
Returns
System.Boolean
Booleans(int)
Section titled “Booleans(int)”public static bool[] Booleans(int count)Generate multiple random booleans.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.Boolean[]
Integer(int, int)
Section titled “Integer(int, int)”public static int Integer(int min = 0, int max = 100)Generate a random integer within range.
Parameters
| Name | Type |
|---|---|
min |
System.Int32 |
max |
System.Int32 |
Returns
System.Int32
Integers(int, int, int)
Section titled “Integers(int, int, int)”public static int[] Integers(int count, int min = 0, int max = 100)Generate multiple random integers.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
min |
System.Int32 |
max |
System.Int32 |
Returns
System.Int32[]
Float(float, float)
Section titled “Float(float, float)”public static float Float(float min = 0, float max = 100)Generate a random float within range.
Parameters
| Name | Type |
|---|---|
min |
System.Single |
max |
System.Single |
Returns
System.Single
Floats(int, float, float)
Section titled “Floats(int, float, float)”public static float[] Floats(int count, float min = 0, float max = 100)Generate multiple random floats.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
min |
System.Single |
max |
System.Single |
Returns
System.Single[]
public static string Url()Generate a random URL.
Returns
System.String
Urls(int)
Section titled “Urls(int)”public static string[] Urls(int count)Generate multiple random URLs.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
IpAddress()
Section titled “IpAddress()”public static string IpAddress()Generate a random IP address.
Returns
System.String
IpAddresses(int)
Section titled “IpAddresses(int)”public static string[] IpAddresses(int count)Generate multiple random IP addresses.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
MacAddress()
Section titled “MacAddress()”public static string MacAddress()Generate a random MAC address (uppercase hex, colon-separated).
Returns
System.String
MacAddresses(int)
Section titled “MacAddresses(int)”public static string[] MacAddresses(int count)Generate multiple random MAC addresses.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
Username()
Section titled “Username()”public static string Username()Generate a random username.
Returns
System.String
Usernames(int)
Section titled “Usernames(int)”public static string[] Usernames(int count)Generate multiple random usernames.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
Password(int)
Section titled “Password(int)”public static string Password(int length = 12)Generate a random password with guaranteed character diversity.
Parameters
| Name | Type |
|---|---|
length |
System.Int32 |
Returns
System.String
Passwords(int, int)
Section titled “Passwords(int, int)”public static string[] Passwords(int count, int length = 12)Generate multiple random passwords.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
length |
System.Int32 |
Returns
System.String[]
CreditCard()
Section titled “CreditCard()”public static string CreditCard()Generate a random credit card number with valid Luhn checksum (fake, for testing only).
Returns
System.String
CreditCards(int)
Section titled “CreditCards(int)”public static string[] CreditCards(int count)Generate multiple random credit card numbers.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
public static string Ssn()Generate a random SSN-shaped string (fake, for testing only).
Returns
System.String
Ssns(int)
Section titled “Ssns(int)”public static string[] Ssns(int count)Generate multiple random SSNs.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
Isbn()
Section titled “Isbn()”public static string Isbn()Generate a random ISBN-13 with valid check digit.
Returns
System.String
Isbns(int)
Section titled “Isbns(int)”public static string[] Isbns(int count)Generate multiple random ISBNs.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
State()
Section titled “State()”public static string State()Generate a random US state name.
Returns
System.String
States(int)
Section titled “States(int)”public static string[] States(int count)Generate multiple random US state names.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
Domain()
Section titled “Domain()”public static string Domain()Generate a random domain name (e.g., “cloudpulse.io”).
Returns
System.String
DomainNames(int)
Section titled “DomainNames(int)”public static string[] DomainNames(int count)Generate multiple random domain names.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
FullAddress()
Section titled “FullAddress()”public static string FullAddress()Generate a random full address (e.g., “1234 Oak Ave, Seattle, WA 98101”).
Returns
System.String
FullAddresses(int)
Section titled “FullAddresses(int)”public static string[] FullAddresses(int count)Generate multiple random full addresses.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
public static int Age()Generate a realistic adult age drawn from a Gaussian distribution (mean 38, stddev 14), clamped to the range 18-85.
Returns
System.Int32
Ages(int)
Section titled “Ages(int)”public static int[] Ages(int count)Generate multiple random ages.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.Int32[]
ProductName()
Section titled “ProductName()”public static string ProductName()Generate a random product name (e.g., “Ultra Wireless Headphones”).
Returns
System.String
ProductNames(int)
Section titled “ProductNames(int)”public static string[] ProductNames(int count)Generate multiple random product names.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
Price(float, float)
Section titled “Price(float, float)”public static string Price(float min = 0.99, float max = 999.99)Generate a random price string (e.g., “$49.99”).
Parameters
| Name | Type |
|---|---|
min |
System.Single |
max |
System.Single |
Returns
System.String
Prices(int, float, float)
Section titled “Prices(int, float, float)”public static string[] Prices(int count, float min = 0.99, float max = 999.99)Generate multiple random prices.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
min |
System.Single |
max |
System.Single |
Returns
System.String[]
StarRating()
Section titled “StarRating()”public static float StarRating()Generate a random star rating (1.0-5.0 with realistic distribution skewed toward 3.5-4.5).
Returns
System.Single
StarRatings(int)
Section titled “StarRatings(int)”public static float[] StarRatings(int count)Generate multiple random star ratings.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.Single[]
VersionNumber()
Section titled “VersionNumber()”public static string VersionNumber()Generate a random semantic version number (e.g., “2.4.1”).
Returns
System.String
VersionNumbers(int)
Section titled “VersionNumbers(int)”public static string[] VersionNumbers(int count)Generate multiple random version numbers.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
FileName()
Section titled “FileName()”public static string FileName()Generate a random file name with extension (e.g., “report_2024.pdf”).
Returns
System.String
FileNames(int)
Section titled “FileNames(int)”public static string[] FileNames(int count)Generate multiple random file names.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
UserAgent()
Section titled “UserAgent()”public static string UserAgent()Generate a random browser user agent string.
Returns
System.String
UserAgents(int)
Section titled “UserAgents(int)”public static string[] UserAgents(int count)Generate multiple random user agent strings.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
Animal()
Section titled “Animal()”public static string Animal()Generate a random animal name.
Returns
System.String
Animals(int)
Section titled “Animals(int)”public static string[] Animals(int count)Generate multiple random animal names.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
Hashtag()
Section titled “Hashtag()”public static string Hashtag()Generate a random hashtag (e.g., “#gamedev”).
Returns
System.String
Hashtags(int)
Section titled “Hashtags(int)”public static string[] Hashtags(int count)Generate multiple random hashtags.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
Honorific()
Section titled “Honorific()”public static string Honorific()Generate a random honorific (e.g., “Dr.”, “Mr.”).
Returns
System.String
Honorifics(int)
Section titled “Honorifics(int)”public static string[] Honorifics(int count)Generate multiple random honorifics.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
Emoji()
Section titled “Emoji()”public static string Emoji()Generate a random emoji character.
Returns
System.String
Emojis(int)
Section titled “Emojis(int)”public static string[] Emojis(int count)Generate multiple random emojis.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
System.String[]
Enum()
Section titled “Enum()”public static T Enum<T>() where T : EnumGenerate a random enum value.
Returns
{T}
Enums(int)
Section titled “Enums(int)”public static T[] Enums<T>(int count) where T : EnumGenerate multiple random enum values.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
{T}[]
Generate(SimpleDataType)
Section titled “Generate(SimpleDataType)”public static string Generate(SimpleDataType type)Generate a single value of the specified type.
Parameters
| Name | Type |
|---|---|
type |
MockMagic.SimpleDataType |
Returns
System.String
Generate(SimpleDataType, int)
Section titled “Generate(SimpleDataType, int)”public static string[] Generate(SimpleDataType type, int count)Generate multiple values of the specified type.
Parameters
| Name | Type |
|---|---|
type |
MockMagic.SimpleDataType |
count |
System.Int32 |
Returns
System.String[]
Seed(int)
Section titled “Seed(int)”public static void Seed(int seed)Seed all MockMagic randomness for reproducible output.
Equivalent to MockMagic.MockRandom.Seed(System.Int32).
Parameters
| Name | Type |
|---|---|
seed |
System.Int32 |
ResetSeed()
Section titled “ResetSeed()”public static void ResetSeed()Clear the seed and restore default behaviour.
Pick(params T[])
Section titled “Pick(params T[])”public static T Pick<T>(params T[] items)Pick a random element from an array.
Parameters
| Name | Type |
|---|---|
items |
{T}[] |
Returns
{T}
PickWeighted(params (float weight, T value)[])
Section titled “PickWeighted(params (float weight, T value)[])”public static T PickWeighted<T>(params (float weight, T value)[] items)Pick a random element biased by weights.
Parameters
| Name | Type |
|---|---|
items |
System.ValueTuple{System.Single,{T}}[] |
Returns
{T}
Shuffle(IList)
Section titled “Shuffle(IList)”public static void Shuffle<T>(IList<T> items)Shuffle a list in place.
Parameters
| Name | Type |
|---|---|
items |
System.Collections.Generic.IList{{T}} |
Subset(T[], int)
Section titled “Subset(T[], int)”public static T[] Subset<T>(T[] items, int count)Return a random subset of unique items from an array.
Parameters
| Name | Type |
|---|---|
items |
{T}[] |
count |
System.Int32 |
Returns
{T}[]
ImageUrl(int, int)
Section titled “ImageUrl(int, int)”public static string ImageUrl(int width = 640, int height = 480)Random picsum.photos URL for the requested dimensions.
Parameters
| Name | Type |
|---|---|
width |
System.Int32 |
height |
System.Int32 |
Returns
System.String
PlaceholderImageUrl(int, int, string, string, string)
Section titled “PlaceholderImageUrl(int, int, string, string, string)”public static string PlaceholderImageUrl(int width = 640, int height = 480, string bg = null, string fg = null, string text = null)placehold.co URL with optional background, foreground, and label.
Parameters
| Name | Type |
|---|---|
width |
System.Int32 |
height |
System.Int32 |
bg |
System.String |
fg |
System.String |
text |
System.String |
Returns
System.String
SvgDataUri(int, int, Color?, string)
Section titled “SvgDataUri(int, int, Color?, string)”public static string SvgDataUri(int width = 640, int height = 480, Color? fill = null, string label = null)Self-contained SVG data URI — useful when you need an offline placeholder asset.
Parameters
| Name | Type |
|---|---|
width |
System.Int32 |
height |
System.Int32 |
fill |
System.Nullable{UnityEngine.Color} |
label |
System.String |
Returns
System.String
Format(string)
Section titled “Format(string)”public static string Format(string pattern)Replace symbols in pattern:
#→ digit 0-9?→ lowercase letter*→ digit or lowercase letter\→ escape the next character (emit it literally)
Any other character is copied verbatim.
Parameters
| Name | Type |
|---|---|
pattern |
System.String |
Returns
System.String
Examples
Mock.Format(“###-##-####”) → “123-45-6789”
Hash(int, bool)
Section titled “Hash(int, bool)”public static string Hash(int length = 40, bool upperCase = false)Random hexadecimal string (default 40 chars == SHA-1 length).
Parameters
| Name | Type |
|---|---|
length |
System.Int32 |
upperCase |
System.Boolean |
Returns
System.String
Hexadecimal(int, bool)
Section titled “Hexadecimal(int, bool)”public static string Hexadecimal(int length, bool upperCase = false)Random hexadecimal string of the requested length.
Parameters
| Name | Type |
|---|---|
length |
System.Int32 |
upperCase |
System.Boolean |
Returns
System.String
AlphaNumeric(int)
Section titled “AlphaNumeric(int)”public static string AlphaNumeric(int length)Random lowercase alphanumeric string (0-9, a-z).
Parameters
| Name | Type |
|---|---|
length |
System.Int32 |
Returns
System.String
Letters(int, bool)
Section titled “Letters(int, bool)”public static string Letters(int length, bool upperCase = false)Random uppercase or mixed-case letter string of the requested length.
Parameters
| Name | Type |
|---|---|
length |
System.Int32 |
upperCase |
System.Boolean |
Returns
System.String
ClampString(string, int, int)
Section titled “ClampString(string, int, int)”public static string ClampString(string value, int min, int max)Truncate or pad value so its length falls in
[min, max]. Padding uses lowercase letters.
Parameters
| Name | Type |
|---|---|
value |
System.String |
min |
System.Int32 |
max |
System.Int32 |
Returns
System.String
Review(int, int)
Section titled “Review(int, int)”public static string Review(int minWords = 8, int maxWords = 30)Build a short product-style review. minWords and maxWords
hint at the desired length — the result rarely strays outside the range.
Parameters
| Name | Type |
|---|---|
minWords |
System.Int32 |
maxWords |
System.Int32 |
Returns
System.String