PeanutButter
|
Class which provides a number of static methods to produce random values. Suggestion: make use of "using static" to bring these methods into your class as if they were local members, ie: using static PeanutButter.RandomGenerators.RandomValueGen;. More...
Classes | |
class | DefaultRanges |
Exposes the default range values used within RandomValueGen when the ranges are omitted by calling code. More... |
Static Public Member Functions | |||||
static T | GetRandom< T > () | ||||
Gets a random value of the specified type by attempting to find the correct random generator method and invoking it. Works on primitives (eg int, string), enums and complex objects. When invoked on a complex object, will attempt to fine (or, if necessary, create) a GenericBuilder to produce the result. | |||||
static IDictionary< TKey, TValue > | GetRandomDictionary< TKey, TValue > () | ||||
Generates a random dictionary of the provided key / value types with at least one item in it. | |||||
static IDictionary< TKey, TValue > | GetRandomDictionary< TKey, TValue > (int minItems) | ||||
Generates a random dictionary of the provided key / value types with at least {minItems} in it. | |||||
static IDictionary< TKey, TValue > | GetRandomDictionary< TKey, TValue > (int minItems, int maxItems) | ||||
Generates a random dictionary of the provided key / value types with at least {minItems} and at most {maxItems} in it. | |||||
static NameValueCollection | GetRandomNameValueCollection () | ||||
Generates a random NameValueCollection with at least one item in it. | |||||
static NameValueCollection | GetRandomNameValueCollection (int minItems) | ||||
Generates a random NameValueCollection with at least {minItems} in it. | |||||
static NameValueCollection | GetRandomNameValueCollection (int minItems, int maxItems) | ||||
Generates a random NameValueCollection with at least {minItems} and at most {maxItems} in it. | |||||
static void | InstallRandomGenerator< T > (Func< T > generator) | ||||
Add a special case for generating random values, eg for types which have no parameterless constructor, but, eg, may have a .Parse method NB: this method is NOT thread-safe when used concurrently with GetRandom<T>() | |||||
static Type | GetRandomType () | ||||
Returns a random loaded type in the current app domain. | |||||
static object | GetRandom (Type type) | ||||
Gets a random value of the specified type by attempting to find the correct random generator method and invoking it. Works on primitives (eg int, string), enums and complex objects. When invoked on a complex object, will attempt to fine (or, if necessary, create) a GenericBuilder to produce the result. | |||||
static int | GetRandomInt () | ||||
Produces a random integer between 0 and 10 inclusive. | |||||
static int | GetRandomInt (int minValue) | ||||
Produces an integer between the provided value and that value + 10, inclusive. | |||||
static int | GetRandomInt (int minValue, int maxValue) | ||||
Returns a random integer within the specified range. | |||||
static int | GetRandomIntKey () | ||||
Returns a random integer from 1 to 1000, as might be seen on an integer id field in a database. | |||||
static int | GetRandomIntKey (int maxValue) | ||||
Returns a random integer from 1 to {maxValue}, as might be seen on an integer id field in a database. | |||||
static bool | GetRandomBoolean () | ||||
Returns a random boolean value. | |||||
static string | GetRandomMIMEType () | ||||
Gets a pseudo-random mimetype (picks from a short list of known mime types) | |||||
static string | GetRandomMimeType () | ||||
Gets a pseudo-random mimetype (picks from a short list of known mime types) | |||||
static long | GetRandomLong () | ||||
Produces a random long between 0 and 1000, inclusive. | |||||
static long | GetRandomLong (long minValue) | ||||
Returns a random long between the provided min value and that value + 1000, inclusive. | |||||
static long | GetRandomLong (long minValue, long maxValue) | ||||
Returns a random long within the specified range. | |||||
static string | GetRandomString (int minLength=DefaultRanges.MINLENGTH_STRING, int? maxLength=null, string charSet=null) | ||||
Gets a random string. | |||||
static DateTime | GetRandomDate (DateTime? minDate, DateTime? maxDate, bool dateOnly, DateTime? minTime, DateTime? maxTime) | ||||
Gets a random Local DateTime value, by default within SQL-safe range. | |||||
static DateTime | GetRandomDate () | ||||
Returns a local random datetime. | |||||
static DateTime | GetRandomDate (DateTimeKind kind) | ||||
Returns a random date-time with the required kind. | |||||
static DateTime | GetRandomDate (DateTimeKind kind, DateTime? minDate, DateTime? maxDate, bool dateOnly, DateTime? minTime, DateTime? maxTime) | ||||
Gets a random DateTime value of the specified kind, by default within SQL-safe range. | |||||
static DateTime | GetRandomDate (DateTime? minDate=null, DateTime? maxDate=null, bool dateOnly=false, TimeSpan? minTime=null, TimeSpan? maxTime=null) | ||||
Gets a random DateTime value of the specified kind, by default within SQL-safe range. | |||||
static DateTime | GetRandomDate (DateTimeKind kind, DateTime? minDate, DateTime? maxDate=null, bool dateOnly=false, TimeSpan? minTime=null, TimeSpan? maxTime=null) | ||||
Gets a random DateTime value of the specified kind, by default within SQL-safe range. | |||||
static DateTimeOffset | GetRandomDateTimeOffset (DateTimeOffset? minDate=null, DateTimeOffset? maxDate=null, TimeSpan? minTime=null, TimeSpan? maxTime=null, bool dateOnly=false) | ||||
Like GetRandomDate, but for DateTimeOffset values. | |||||
static DateTime | GetRandomUtcDate (DateTime? minDate, DateTime? maxDate, bool dateOnly, DateTime? minTime, DateTime? maxTime) | ||||
Returns a random UTC date within the specified range. | |||||
static DateTime | GetRandomUtcDate (DateTime? minDate=null, DateTime? maxDate=null, bool dateOnly=false, TimeSpan? minTime=null, TimeSpan? maxTime=null) | ||||
Returns a random UTC date within the specified range. | |||||
static DateRange | GetRandomDateRange (DateTime? minDate=null, DateTime? maxDate=null, bool dateOnly=false, DateTime? minTime=null, DateTime? maxTime=null) | ||||
Gets a random Local DateTime range, by default within SQL-safe range. | |||||
static DateRange | GetRandomUtcDateRange (DateTime? minDate=null, DateTime? maxDate=null, bool dateOnly=false, DateTime? minTime=null, DateTime? maxTime=null) | ||||
Gets a random Local DateTime range, by default within SQL-safe range. | |||||
static TimeSpan | GetRandomTimeSpan (double min, double max=DefaultRanges.MAX_INT_VALUE, TimeSpanContexts context=TimeSpanContexts.Minutes) | ||||
Gets a random timespan. | |||||
static TimeSpan | GetRandomTimeSpan (TimeSpan min, TimeSpan? max=null) | ||||
Returns a TimeSpan between min and max. | |||||
static TimeSpan | GetRandomTimeSpan () | ||||
Returns a random TimeSpan between TimeSpan.Z. | |||||
static DateRange | GetRandomDateRange (DateTimeKind kind, DateTime? minDate=null, DateTime? maxDate=null, bool dateOnly=false, DateTime? minTime=null, DateTime? maxTime=null) | ||||
Gets a random DateTime range of the specified kind, by default within SQL-safe range. | |||||
static double | GetRandomDouble () | ||||
Produces a random double value between 0 and 10 inclusive. | |||||
static double | GetRandomDouble (double minValue) | ||||
Produces a random double value between the provides double value and that value + 10, inclusive. | |||||
static double | GetRandomDouble (double min, double max) | ||||
Gets a random double value within the specified range. | |||||
static decimal | GetRandomDecimal (double min, double max) | ||||
Gets a random decimal value within the specified range. | |||||
static decimal | GetRandomDecimal (long min, long max) | ||||
Gets a random decimal value within the specified range. | |||||
static decimal | GetRandomDecimal (decimal min, decimal max) | ||||
Gets a random decimal value within the specified range. | |||||
static decimal | GetRandomDecimal () | ||||
Produces a random decimal between 0 and 10 inclusive. | |||||
static decimal | GetRandomDecimal (decimal minValue) | ||||
Produces a random decimal between the provided minValue and that value + 10, inclusive. | |||||
static decimal | GetRandomMoney (decimal min, decimal max) | ||||
Gets a random money value (decimal with max 2 places) within the specified range. | |||||
static decimal | GetRandomMoney () | ||||
Produces a money value (decimal with max 2 places) between 10 and 100 inclusive. | |||||
static decimal | GetRandomMoney (decimal minValue) | ||||
Produces a random decimal between the provided minValue and that value + 10, inclusive. | |||||
static decimal | GetRandomTaxRate (decimal min, decimal max) | ||||
Gets a random tax rate value (decimal with max 2 places) within the specified range. | |||||
static decimal | GetRandomTaxRate () | ||||
Produces a tax rate value (decimal with max 2 places) between 3 and 20 inclusive. | |||||
static decimal | GetRandomTaxRate (decimal minValue) | ||||
Produces a tax rate value (decimal with max 2 places) between of the provided minimum value up to that value. | |||||
static decimal | GetRandomInterestRate (decimal min, decimal max) | ||||
Gets a random interest rate value (decimal with max 2 places) within the specified range. | |||||
static decimal | GetRandomInterestRate () | ||||
Produces a interest rate value (decimal with max 2 places) between 3 and 20 inclusive. | |||||
static decimal | GetRandomInterestRate (decimal minValue) | ||||
Produces a interest rate value (decimal with max 2 places) between of the provided minimum value up to that value. | |||||
static decimal | GetRandomDecimal (long minValue) | ||||
Produces a random decimal between the provided minValue and that value + 10, inclusive. | |||||
static decimal | GetRandomDecimal (double minValue) | ||||
Produces a random decimal between the provided minValue and that value + 10, inclusive. | |||||
static float | GetRandomFloat () | ||||
Produces a random float between 0 and 10 inclusive. | |||||
static float | GetRandomFloat (float minValue) | ||||
Produces a random float between the provided minValue and that value + 10, inclusive. | |||||
static float | GetRandomFloat (float min, float max) | ||||
Gets a random float value within the specified range. | |||||
static TimeSpan | GetRandomTimeOfDay () | ||||
Produces a random time of day. | |||||
static TimeSpan | GetRandomTimeOfDay (TimeSpan min) | ||||
Produces a random time of day from the provided minimum, inclusive. | |||||
static TimeSpan | GetRandomTimeOfDay (TimeSpan min, TimeSpan max) | ||||
Returns a random time of day. | |||||
static byte[] | GetRandomBytes () | ||||
Produces an array of random bytes between 0 and 1024 in length, inclusive. | |||||
static byte[] | GetRandomBytes (int minLength) | ||||
Produces some random bytes, of at least minLength in size, up to that length + 1024, inclusive. | |||||
static byte[] | GetRandomBytes (int minLength, int maxLength) | ||||
Gets a randomly-sized, randomly-filled byte array. | |||||
static string | GetRandomEmail () | ||||
Gets a random email-like string. Note that this is only email-like in that it conforms to the structure: {random-string}random-string}.com. | |||||
static string | GetRandomEmail (string firstName) | ||||
Gets a random email-like string. Note that this is only email-like in that it conforms to the structure: {random-string}random-string}.com
| |||||
static string | GetRandomEmail (string firstName, string lastName) | ||||
Gets a random email-like string. Note that this is only email-like in that it conforms to the structure: {random-string}random-string}.com
| |||||
static string | GetRandomDomain () | ||||
Returns a random domain generated from a fairly common internet company name and one of the known TLDs at time of generation. | |||||
static string | GetRandomUserName () | ||||
Produces a random username: | |||||
static string | GetRandomUserName (string firstName) | ||||
Produces a random username: | |||||
static string | GetRandomUserName (string firstName, string lastName) | ||||
Produces a random username: | |||||
static string | GetRandomCityName () | ||||
Generates a city name. | |||||
static string | GetRandomCountry () | ||||
Returns a random country. | |||||
static string | GetRandomCountryCode () | ||||
Returns a random country code. | |||||
static string | GetRandomStreetAddress () | ||||
Generates a street address. | |||||
static string | GetRandomStreetName () | ||||
Generates a street name. | |||||
static string | GetRandomStreetNumber () | ||||
Generates a street number (eg 12 or 134a) | |||||
static string | GetRandomStreetAddress (string streetName) | ||||
Generates a street address, given a street name. | |||||
static string | GetRandomStreetAddress (string streetNumber, string streetName) | ||||
Generates a street address, given a street number and / or name (null values are discarded & random values will be generated) | |||||
static string | GetRandomPostalCode () | ||||
Generates a random postal code. | |||||
static string | GetRandomAddress () | ||||
Generates a random multi-line address. | |||||
static string | GetRandomFirstName () | ||||
Returns a random first name, sourced from unique top names: | |||||
static string | GetRandomPlaceName () | ||||
Generates a random fantasy place name. | |||||
static string | GetRandomLastName () | ||||
Returns a random last name, source from unique top names: | |||||
static string | GetRandomTopLevelDomainName () | ||||
Returns a random. | |||||
static string | GetRandomName () | ||||
Returns a random name of the format {FirstName} {LastName}. | |||||
static string | GetRandomFileName () | ||||
Gets a random filename. Does not use the OS-level temporary filename functions. | |||||
static string | GetRandomFileExtension () | ||||
Returns a random valid file extension. | |||||
static string | GetRandomWindowsPath () | ||||
Gets a random path which resembles a Windows path, including a leading drive. | |||||
static string | GetRandomWords () | ||||
Produces a collection of words between 10 and 50 words in length, inclusive. | |||||
static string | GetRandomWords (int minWords) | ||||
Produces a collection of words with count of at least minWords up to and including minWords + 50. | |||||
static string | GetRandomWords (int minWords, int maxWords) | ||||
Gets some random pseudo-words. Note that they (probably) won't be readable words – just a collection of strings with whitespace in between. Think of this as something like Lorei Ipsum, except with zero meaning. | |||||
static string | GetRandomHttpUrl () | ||||
Generates a random string which looks a lot like an http url, to the domain only (no path or parameters) | |||||
static string | GetRandomHttpMethod () | ||||
Returns a random http verb, ie one of. | |||||
static string | GetRandomCommonHttpMethod () | ||||
Returns a "more common" http method: | |||||
static string | GetRandomHttpUrlWithPath () | ||||
Produces a string which looks just like an http url with a path. | |||||
static string | GetRandomHttpUrlWithPathAndParameters () | ||||
Produces a string that looks like an http url with path and parameters. | |||||
static string | GetRandomHttpPathAndParameters () | ||||
Produces just the path and query string for an http request. | |||||
static string | GetRandomHttpUrlWithParameters () | ||||
Generates a random HTTP url with some query parameters. | |||||
static string | GetRandomHttpsUrl () | ||||
Generates a random string which looks a lot like an https url, to the domain only (no path or parameters) | |||||
static string | GetRandomHttpsUrlWithPath () | ||||
Produces a string which looks just like an https url with a path. | |||||
static string | GetRandomHttpsUrlWithPathAndParameters () | ||||
Produces a string that looks like an https url with path and parameters. | |||||
static string | GetRandomHttpsUrlWithParameters () | ||||
Generates a random https url with some query parameters. | |||||
static string | GetRandomPath () | ||||
Generates a random string which looks like a relative path on the internet or any reasonable filesystem. | |||||
static string | GetRandomAbsolutePath () | ||||
Returns an absolute random path (ie, always starts with /) | |||||
static string | GetRandomUrlQuery () | ||||
Generates a random query string for an url. | |||||
static string | GetRandomUrlParameters () | ||||
Generates a string of random url parameters. | |||||
static string | GetRandomAlphaNumericString (int minLength=DefaultRanges.MINLENGTH_STRING, int? maxLength=null) | ||||
Gets a random string made up only of alphanumeric characters. | |||||
static string | GetRandomNonAlphaNumericString (int minChars=0, int maxChars=10) | ||||
Gets a random string made of non-alpha-numeric (but printable) chars. | |||||
static string | GetRandomAlphaString (int minLength=DefaultRanges.MINLENGTH_STRING, int? maxLength=null) | ||||
Gets a random string made up only of alphabetic characters. | |||||
static string | GetRandomNumericString (int minLength=DefaultRanges.MINLENGTH_STRING, int? maxLength=null) | ||||
Gets a random string made up only of numeric characters. | |||||
static T | GetRandomEnum< T > () | ||||
Gets a random enum value from the specified enum type. | |||||
static T | GetRandomEnum< T > (params T[] excludingValues) | ||||
Gets a random enum value from the specified enum type. You may optionally specify enum values that you don't want in the output. | |||||
static T | GetRandomEnum< T > (Func< T, bool > validator) | ||||
Gets a random enum value from the specified enum type with validation for a required value. | |||||
static string | GetRandomVersionString (int partCount=3) | ||||
Gets a random version-like string (eg 1.2.3) | |||||
static Version | GetRandomVersion () | ||||
Gets a random System.Version instance. | |||||
static string | CreateRandomFolderIn (string path) | ||||
Creates a randomly-named folder within another existing folder and returns the name of that folder. | |||||
static IEnumerable< string > | CreateRandomFoldersIn (string path, int depth=2) | ||||
Creates some randomly-named folder within another existing folder and returns the names of those folders. | |||||
static string | CreateRandomFileIn (string path) | ||||
Creates a randomly-named file within the provided folder path and returns its name. | |||||
static string | CreateRandomTextFileIn (string path) | ||||
Creates a randomly-named file within the provided folder path and populates it with some random text data; returns the name of the file. | |||||
static IEnumerable< string > | CreateRandomFileTreeIn (string path) | ||||
Creates a full random file tree (folders and some files, to a depth of 2) under a given path. Useful when you need to test utilities which trawl the filesystem. | |||||
static IEnumerable< string > | CreateRandomFileTreeIn (string path, int depth) | ||||
Creates a full random file tree (folders and some files) under a given path. Useful when you need to test utilities which trawl the filesystem. | |||||
static string | GetRandomLanguageCode () | ||||
Provides a random language code. | |||||
static string | GetRandomLanguageName () | ||||
Provides a random language name. |
Class which provides a number of static methods to produce random values. Suggestion: make use of "using static" to bring these methods into your class as if they were local members, ie: using static PeanutButter.RandomGenerators.RandomValueGen;.
|
static |
Creates a randomly-named file within the provided folder path and returns its name.
path | Folder within which to create the file |
|
static |
Creates a full random file tree (folders and some files, to a depth of 2) under a given path. Useful when you need to test utilities which trawl the filesystem.
path | Folder in which to create the tree |
|
static |
Creates a full random file tree (folders and some files) under a given path. Useful when you need to test utilities which trawl the filesystem.
path | Folder in which to create the tree |
depth | How deep to make the folder structure |
|
static |
Creates a randomly-named folder within another existing folder and returns the name of that folder.
path | Base path within which to create the new folder |
|
static |
Creates some randomly-named folder within another existing folder and returns the names of those folders.
path | Base path within which to create the new folder |
depth | How deep to go when creating the tree |
|
static |
Creates a randomly-named file within the provided folder path and populates it with some random text data; returns the name of the file.
path | Folder within which to create the file |
|
static |
Gets a random value of the specified type by attempting to find the correct random generator method and invoking it. Works on primitives (eg int, string), enums and complex objects. When invoked on a complex object, will attempt to fine (or, if necessary, create) a GenericBuilder to produce the result.
type | Type to generate a random value of |
|
static |
Gets a random value of the specified type by attempting to find the correct random generator method and invoking it. Works on primitives (eg int, string), enums and complex objects. When invoked on a complex object, will attempt to fine (or, if necessary, create) a GenericBuilder to produce the result.
T | Type to generate a random value of |
|
static |
Returns an absolute random path (ie, always starts with /)
|
static |
Generates a random multi-line address.
|
static |
Gets a random string made up only of alphanumeric characters.
minLength | Minimum length required |
maxLength | Maximum length required |
|
static |
Gets a random string made up only of alphabetic characters.
minLength | Minimum length required |
maxLength | Maximum length required |
|
static |
Returns a random boolean value.
|
static |
Produces an array of random bytes between 0 and 1024 in length, inclusive.
|
static |
Produces some random bytes, of at least minLength in size, up to that length + 1024, inclusive.
minLength |
|
static |
Gets a randomly-sized, randomly-filled byte array.
minLength | Minimum size of the result |
maxLength | Maximum size of the result |
|
static |
Generates a city name.
|
static |
Returns a "more common" http method:
|
static |
Returns a random country.
|
static |
Returns a random country code.
|
static |
Returns a local random datetime.
|
static |
Gets a random Local DateTime value, by default within SQL-safe range.
minDate | Minimum date to consider |
maxDate | Maximum date to consider |
dateOnly | Flag to determine if times should be truncated |
minTime | Minimum time to consider (default all) |
maxTime | Maximum time to consider (default all) |
|
static |
Gets a random DateTime value of the specified kind, by default within SQL-safe range.
minDate | Minimum date to consider |
maxDate | Maximum date to consider |
dateOnly | Flag to determine if times should be truncated |
minTime | Minimum time to consider (default all) |
maxTime | Maximum time to consider (default all) |
|
static |
Returns a random date-time with the required kind.
kind |
|
static |
Gets a random DateTime value of the specified kind, by default within SQL-safe range.
kind | DateTimeKind required for this value |
minDate | Minimum date to consider |
maxDate | Maximum date to consider |
dateOnly | Flag to determine if times should be truncated |
minTime | Minimum time to consider (default all) |
maxTime | Maximum time to consider (default all) |
|
static |
Gets a random DateTime value of the specified kind, by default within SQL-safe range.
kind | DateTimeKind required for this value |
minDate | Minimum date to consider |
maxDate | Maximum date to consider |
dateOnly | Flag to determine if times should be truncated |
minTime | Minimum time to consider (default all) |
maxTime | Maximum time to consider (default all) |
|
static |
Gets a random Local DateTime range, by default within SQL-safe range.
minDate | Minimum date to consider |
maxDate | Maximum date to consider |
dateOnly | Flag to determine if times should be truncated |
minTime | Minimum time to consider (default all) |
maxTime | Maximum time to consider (default all) |
|
static |
Gets a random DateTime range of the specified kind, by default within SQL-safe range.
kind | DateTimeKind required for this value |
minDate | Minimum date to consider |
maxDate | Maximum date to consider |
dateOnly | Flag to determine if times should be truncated |
minTime | Minimum time to consider (default all) |
maxTime | Maximum time to consider (default all) |
|
static |
Like GetRandomDate, but for DateTimeOffset values.
minDate | |
maxDate | |
minTime | |
maxTime | |
dateOnly |
|
static |
Produces a random decimal between 0 and 10 inclusive.
|
static |
Gets a random decimal value within the specified range.
min | Minimum value to consider |
max | Maximum value to consider |
|
static |
Produces a random decimal between the provided minValue and that value + 10, inclusive.
minValue |
|
static |
Gets a random decimal value within the specified range.
min | Minimum value to consider |
max | Maximum value to consider |
|
static |
Produces a random decimal between the provided minValue and that value + 10, inclusive.
minValue |
|
static |
Gets a random decimal value within the specified range.
min | Minimum value to consider |
max | Maximum value to consider |
|
static |
Produces a random decimal between the provided minValue and that value + 10, inclusive.
minValue |
|
static |
Generates a random dictionary of the provided key / value types with at least one item in it.
TKey | |
TValue |
|
static |
Generates a random dictionary of the provided key / value types with at least {minItems} in it.
TKey | |
TValue |
|
static |
Generates a random dictionary of the provided key / value types with at least {minItems} and at most {maxItems} in it.
TKey | |
TValue |
|
static |
Returns a random domain generated from a fairly common internet company name and one of the known TLDs at time of generation.
|
static |
Produces a random double value between 0 and 10 inclusive.
|
static |
Gets a random double value within the specified range.
min | Minimum value to consider |
max | Maximum value to consider |
|
static |
Produces a random double value between the provides double value and that value + 10, inclusive.
minValue |
|
static |
Gets a random email-like string. Note that this is only email-like in that it conforms to the structure: {random-string}random-string}.com.
|
static |
Gets a random email-like string. Note that this is only email-like in that it conforms to the structure: {random-string}random-string}.com
firstName | Use a first-name to guide the process |
|
static |
Gets a random email-like string. Note that this is only email-like in that it conforms to the structure: {random-string}random-string}.com
firstName | Use a first-name to guide the process |
lastName | Use a last-name to guide the process |
|
static |
Gets a random enum value from the specified enum type.
T | Type of enum to use as a source |
ArgumentException | Thrown when GetRandomEnum is called on a non-enum type (since there is no generic constraint for enum types, yet) |
T | : | struct | |
T | : | IConvertible |
|
static |
Gets a random enum value from the specified enum type with validation for a required value.
T | Type of enum to use as a source |
ArgumentException | Thrown when GetRandomEnum is called on a non-enum type (since there is no generic constraint for enum types, yet) |
|
static |
Gets a random enum value from the specified enum type. You may optionally specify enum values that you don't want in the output.
T | Type of enum to use as a source |
ArgumentException | Thrown when GetRandomEnum is called on a non-enum type (since there is no generic constraint for enum types, yet) |
T | : | struct | |
T | : | IConvertible |
|
static |
Returns a random valid file extension.
|
static |
Gets a random filename. Does not use the OS-level temporary filename functions.
|
static |
Returns a random first name, sourced from unique top names:
|
static |
Produces a random float between 0 and 10 inclusive.
|
static |
Gets a random float value within the specified range.
min | Minimum value to consider |
max | Maximum value to consider |
|
static |
Produces a random float between the provided minValue and that value + 10, inclusive.
minValue |
|
static |
Returns a random http verb, ie one of.
|
static |
Produces just the path and query string for an http request.
|
static |
Generates a random string which looks a lot like an https url, to the domain only (no path or parameters)
|
static |
Generates a random https url with some query parameters.
|
static |
Produces a string which looks just like an https url with a path.
|
static |
Produces a string that looks like an https url with path and parameters.
|
static |
Generates a random string which looks a lot like an http url, to the domain only (no path or parameters)
|
static |
Generates a random HTTP url with some query parameters.
|
static |
Produces a string which looks just like an http url with a path.
|
static |
Produces a string that looks like an http url with path and parameters.
|
static |
Produces a random integer between 0 and 10 inclusive.
|
static |
Produces an integer between the provided value and that value + 10, inclusive.
minValue |
|
static |
Returns a random integer within the specified range.
minValue | Minimum value to consider |
maxValue | Maximum value to consider |
|
static |
Produces a interest rate value (decimal with max 2 places) between 3 and 20 inclusive.
|
static |
Gets a random interest rate value (decimal with max 2 places) within the specified range.
min | Minimum value to consider |
max | Maximum value to consider |
|
static |
Produces a interest rate value (decimal with max 2 places) between of the provided minimum value up to that value.
minValue |
|
static |
Returns a random integer from 1 to 1000, as might be seen on an integer id field in a database.
|
static |
Returns a random integer from 1 to {maxValue}, as might be seen on an integer id field in a database.
maxValue |
ArgumentException | Thrown if maxValue is provided < 2 |
|
static |
Provides a random language code.
|
static |
Provides a random language name.
|
static |
Returns a random last name, source from unique top names:
|
static |
Produces a random long between 0 and 1000, inclusive.
|
static |
Returns a random long between the provided min value and that value + 1000, inclusive.
minValue |
|
static |
Returns a random long within the specified range.
minValue | Minimum value to consider |
maxValue | Maximum value to consider |
|
static |
Gets a pseudo-random mimetype (picks from a short list of known mime types)
|
static |
Gets a pseudo-random mimetype (picks from a short list of known mime types)
|
static |
Produces a money value (decimal with max 2 places) between 10 and 100 inclusive.
|
static |
Gets a random money value (decimal with max 2 places) within the specified range.
min | Minimum value to consider |
max | Maximum value to consider |
|
static |
Produces a random decimal between the provided minValue and that value + 10, inclusive.
minValue |
|
static |
Returns a random name of the format {FirstName} {LastName}.
|
static |
Generates a random NameValueCollection with at least one item in it.
|
static |
Generates a random NameValueCollection with at least {minItems} in it.
|
static |
Generates a random NameValueCollection with at least {minItems} and at most {maxItems} in it.
|
static |
Gets a random string made of non-alpha-numeric (but printable) chars.
minChars | |
maxChars |
|
static |
Gets a random string made up only of numeric characters.
minLength | Minimum length required |
maxLength | Maximum length required |
|
static |
Generates a random string which looks like a relative path on the internet or any reasonable filesystem.
|
static |
Generates a random fantasy place name.
|
static |
Generates a random postal code.
|
static |
Generates a street address.
|
static |
Generates a street address, given a street name.
streetName |
|
static |
Generates a street address, given a street number and / or name (null values are discarded & random values will be generated)
streetNumber | |
streetName |
|
static |
Generates a street name.
|
static |
Generates a street number (eg 12 or 134a)
|
static |
Gets a random string.
minLength | Minimum length required |
maxLength | Maximum length required. When left null, will be the minimum length plus DefaultRanges.MINLENGTH_STRING |
charSet | Character set to use, as required |
|
static |
Produces a tax rate value (decimal with max 2 places) between 3 and 20 inclusive.
|
static |
Gets a random tax rate value (decimal with max 2 places) within the specified range.
min | Minimum value to consider |
max | Maximum value to consider |
|
static |
Produces a tax rate value (decimal with max 2 places) between of the provided minimum value up to that value.
minValue |
|
static |
Produces a random time of day.
|
static |
Produces a random time of day from the provided minimum, inclusive.
min |
|
static |
Returns a random time of day.
min | Minimum time to consider |
max | Maximum time to consider |
|
static |
Returns a random TimeSpan between TimeSpan.Z.
|
static |
Gets a random timespan.
min | Minimum length |
max | Maximum length |
context | Context for the min/max length |
|
static |
Returns a TimeSpan between min and max.
min | min timespan – defaults to TimeSpan.Zero |
max | max timespan – defaults to TimeSpan.MaxValue |
|
static |
Returns a random.
|
static |
Returns a random loaded type in the current app domain.
|
static |
Generates a string of random url parameters.
|
static |
Generates a random query string for an url.
|
static |
Produces a random username:
|
static |
Produces a random username:
firstName | Use a first-name to guide the process |
|
static |
Produces a random username:
firstName | Use a first-name to guide the process |
lastName | Use a last-name to guide the process |
|
static |
Returns a random UTC date within the specified range.
minDate | |
maxDate | |
dateOnly | |
minTime | |
maxTime |
|
static |
Returns a random UTC date within the specified range.
minDate | |
maxDate | |
dateOnly | |
minTime | |
maxTime |
|
static |
Gets a random Local DateTime range, by default within SQL-safe range.
minDate | Minimum date to consider |
maxDate | Maximum date to consider |
dateOnly | Flag to determine if times should be truncated |
minTime | Minimum time to consider (default all) |
maxTime | Maximum time to consider (default all) |
|
static |
Gets a random System.Version instance.
|
static |
Gets a random version-like string (eg 1.2.3)
partCount | How many parts to have in your version string |
|
static |
Gets a random path which resembles a Windows path, including a leading drive.
|
static |
Produces a collection of words between 10 and 50 words in length, inclusive.
|
static |
Produces a collection of words with count of at least minWords up to and including minWords + 50.
minWords |
|
static |
Gets some random pseudo-words. Note that they (probably) won't be readable words – just a collection of strings with whitespace in between. Think of this as something like Lorei Ipsum, except with zero meaning.
minWords | Minimum number of "words" to return |
maxWords | Maximum number of "words" to return |
|
static |
Add a special case for generating random values, eg for types which have no parameterless constructor, but, eg, may have a .Parse method NB: this method is NOT thread-safe when used concurrently with GetRandom<T>()
generator |