Show / Hide Table of Contents

Class RandomEx

Class containing some extension methods for System.Random.

Inheritance
System.Object
RandomEx
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 RandomEx

Methods

| Improve this Doc View Source

CoinToss(Random)

Returns randomly true or false.

Declaration
public static bool CoinToss(this Random random)
Parameters
Type Name Description
System.Random random

The random to use.

Returns
Type Description
System.Boolean

Returns true or false (random value).

Exceptions
Type Condition
System.ArgumentNullException

random can not be null.

| Improve this Doc View Source

RandomOne<T>(Random, T[])

Returns randomly one of the given values.

Declaration
public static T RandomOne<T>(this Random random, params T[] values)
Parameters
Type Name Description
System.Random random

The random to use.

T[] values

A list of values.

Returns
Type Description
T

Returns randomly one of the given values.

Type Parameters
Name Description
T The type of the values.
Exceptions
Type Condition
System.ArgumentNullException

The random can not be null.

System.ArgumentNullException

The values can not be null.

| Improve this Doc View Source

RandomOne<T>(Random, IEnumerable<T>)

Returns randomly one of the given values.

Declaration
public static T RandomOne<T>(this Random random, IEnumerable<T> values)
Parameters
Type Name Description
System.Random random

The random to use.

System.Collections.Generic.IEnumerable<T><T> values

A IEnumerable containing the values.

Returns
Type Description
T

Returns randomly one of the given values.

Type Parameters
Name Description
T The type of the values.
Exceptions
Type Condition
System.ArgumentNullException

The random can not be null.

System.ArgumentNullException

The values can not be null.

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