Show / Hide Table of Contents

Class RandomValueEx

Class containing some methods to generate random values.

Inheritance
System.Object
RandomValueEx
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace:Extend
Assembly:Extend.dll
Syntax
public static class RandomValueEx

Methods

| Improve this Doc View Source

GetRandomBoolean()

Gets a random Boolean value.

Declaration
public static bool GetRandomBoolean()
Returns
Type Description
System.Boolean

A random Boolean value.

| Improve this Doc View Source

GetRandomByte()

Gets a random System.Byte value.

Declaration
public static byte GetRandomByte()
Returns
Type Description
System.Byte

A random System.Byte value.

| Improve this Doc View Source

GetRandomChar()

Gets random char.

Declaration
public static char GetRandomChar()
Returns
Type Description
System.Char

A random char.

| Improve this Doc View Source

GetRandomDateTime(Nullable<DateTime>, Nullable<DateTime>)

Gets a random date-time value between the given minimum and maximum.

Declaration
public static DateTime GetRandomDateTime(DateTime? min = null, DateTime? max = null)
Parameters
Type Name Description
System.Nullable<T><System.DateTime> min

The minimum value.

System.Nullable<T><System.DateTime> max

The maximum value.

Returns
Type Description
System.DateTime

Returns the generated random date-time value.

Remarks

Default value for minimum is: 01.01.1753. Default value for maximum is: 31.12.9999.

| Improve this Doc View Source

GetRandomDouble(Double, Double)

Gets a random System.Double value which is in the specified range.

Declaration
public static double GetRandomDouble(double min = -1.7976931348623157E+308, double max = 1.7976931348623157E+308)
Parameters
Type Name Description
System.Double min

The inclusive min bound.

Double.MinValue
System.Double max

The exclusive maximum bound. Must be greater than min.

Double.MaxValue
Returns
Type Description
System.Double

A random System.Double value.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

min is greater than max

| Improve this Doc View Source

GetRandomEnum<T>()

Gets a random value of the enumeration of the specified type.

Declaration
public static T GetRandomEnum<T>()where T : struct
Returns
Type Description
T

A random value of the enumeration of the specified type.

Type Parameters
Name Description
T The type of the enumeration.
| Improve this Doc View Source

GetRandomInt16(Int16, Int16)

Gets a random integer value which is in the specified range.

Declaration
public static short GetRandomInt16(short min = -32768, short max = 32767)
Parameters
Type Name Description
System.Int16 min

The inclusive min bound.

Int16.MinValue
System.Int16 max

The exclusive maximum bound. Must be greater than min.

Int16.MaxValue
Returns
Type Description
System.Int16

A random integer value.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

min is greater than max

| Improve this Doc View Source

GetRandomInt32(Int32, Int32)

Gets a random integer value which is in the specified range.

Declaration
public static int GetRandomInt32(int min = -2147483648, int max = 2147483647)
Parameters
Type Name Description
System.Int32 min

The inclusive min bound.

Int32.MinValue
System.Int32 max

The exclusive maximum bound. Must be greater than min.

Int32.MaxValue
Returns
Type Description
System.Int32

A random integer value.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

min is greater than max

| Improve this Doc View Source

GetRandomInt64(Int64, Int64)

Gets a random long value which is in the specified range.

Declaration
public static long GetRandomInt64(long min = -9223372036854775808L, long max = 9223372036854775807L)
Parameters
Type Name Description
System.Int64 min

The inclusive min bound.

Int64.MinValue
System.Int64 max

The exclusive maximum bound. Must be greater than min.

Int64.MaxValue
Returns
Type Description
System.Int64

A random long value.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

min is greater than max

| Improve this Doc View Source

GetRandomString()

Gets random string.

Declaration
public static string GetRandomString()
Returns
Type Description
System.String

A random string.

| Improve this Doc View Source

GetRandomStrings(Nullable<Int32>)

Gets a list of random strings.

Declaration
public static List<string> GetRandomStrings(int ? numberOfItems = null)
Parameters
Type Name Description
System.Nullable<T><System.Int32> numberOfItems

The number of items to generate.

Returns
Type Description
System.Collections.Generic.List<T><System.String>

A list of random strings.

  • Improve this Doc
  • View Source
Back to top Copyright © 2015-2016 Microsoft
Generated by DocFX