<PackageReference Include="NUnit" Version="4.1.0" />

Randomizer

public class Randomizer : Random
Randomizer returns a set of random values in a repeatable way, to allow re-running of tests if necessary. It extends the .NET Random class, providing random values for a much wider range of types. The class is used internally by the framework to generate test case data and is also exposed for use by users through the TestContext.Random property.
public const string DefaultStringChars = "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789_"

Default characters for random functions.

public static int InitialSeed { get; set; }

Initial seed used to create randomizers for this run

public Randomizer()

Default constructor

public Randomizer(int seed)

Construct based on seed value

public static Randomizer CreateRandomizer()

Create a new Randomizer using the next seed available to ensure that each randomizer gives a unique sequence of values.

public static Randomizer GetRandomizer(MemberInfo member)

Get a Randomizer for a particular member, returning one that has already been created if it exists. This ensures that the same values are generated each time the tests are reloaded.

public static Randomizer GetRandomizer(ParameterInfo parameter)

Get a randomizer for a particular parameter, returning one that has already been created if it exists. This ensures that the same values are generated each time the tests are reloaded.

public string GetString(int outputLength, string allowedChars)

Generate a random string based on the characters from the input string.

public string GetString(int outputLength)

Generate a random string based on the characters from the input string.

public string GetString()

Generate a random string based on the characters from the input string.

public bool NextBool()

Returns a random bool

public bool NextBool(double probability)

Returns a random bool based on the probability a true result

public byte NextByte()

Returns a random Byte

public byte NextByte(byte max)

Returns a random Byte less than the specified maximum.

public byte NextByte(byte min, byte max)

Returns a random Byte within a specified range

public decimal NextDecimal()

Returns a random decimal.

public decimal NextDecimal(decimal max)

Returns a random decimal between positive zero and the specified maximum.

public decimal NextDecimal(decimal min, decimal max)

Returns a random decimal within a specified range, which is not permitted to exceed decimal.MaxVal in the current implementation.

public double NextDouble(double max)

Returns a random double between 0.0 and the specified maximum.

public double NextDouble(double min, double max)

Returns a random double within a specified range.

public object NextEnum(Type type)

Returns a random enum value of the specified Type as an object.

public T NextEnum<T>()

Returns a random enum value of the specified Type.

public float NextFloat()

Returns a random float.

public float NextFloat(float max)

Returns a random float between 0.0 and the specified maximum.

public float NextFloat(float min, float max)

Returns a random float within a specified range.

public Guid NextGuid()

Generates a valid version 4 Guid.

public long NextLong()

Returns a random long.

public long NextLong(long max)

Returns a random long less than the specified maximum.

public long NextLong(long min, long max)

Returns a non-negative random long within a specified range.

public sbyte NextSByte()

Returns a random SByte

public sbyte NextSByte(sbyte max)

Returns a random sbyte less than the specified maximum.

public sbyte NextSByte(sbyte min, sbyte max)

Returns a random sbyte within a specified range

public short NextShort()

Returns a non-negative random short.

public short NextShort(short max)

Returns a non-negative random short less than the specified maximum.

public short NextShort(short min, short max)

Returns a non-negative random short within a specified range.

public uint NextUInt()

Returns a random unsigned int.

public uint NextUInt(uint max)

Returns a random unsigned int less than the specified maximum.

public uint NextUInt(uint min, uint max)

Returns a random unsigned int within a specified range.

public ulong NextULong()

Returns a random ulong.

public ulong NextULong(ulong max)

Returns a random ulong less than the specified maximum.

public ulong NextULong(ulong min, ulong max)

Returns a non-negative random long within a specified range.

public ushort NextUShort()

Returns a random unsigned short.

public ushort NextUShort(ushort max)

Returns a random unsigned short less than the specified maximum.

public ushort NextUShort(ushort min, ushort max)

Returns a random unsigned short within a specified range.