Table of Contents

Method ChooseUniformRandom

Namespace
Gamelogic.Extensions.Algorithms
Assembly
Gamelogic.Extensions.dll

ChooseUniformRandom<TSource>(IList<TSource>)

Make a generator that randomly generates elements from a list.

public static IGenerator<TSource> ChooseUniformRandom<TSource>(IList<TSource> source)

Parameters

source IList<TSource>

The source list.

Returns

IGenerator<TSource>

A new generator.

Type Parameters

TSource

The type of elements to generate.

Exceptions

ArgumentNullException

source is null

ArgumentException

sourceis empty.

ChooseUniformRandom<TSource>(IList<TSource>, int)

Make a generator that randomly generates elements from a list. Can be seeded.

public static IGenerator<TSource> ChooseUniformRandom<TSource>(IList<TSource> source, int seed)

Parameters

source IList<TSource>

The source list.

seed int

The seed of the random number generator to use.

Returns

IGenerator<TSource>

A new generator.

Type Parameters

TSource

The type of elements to generate.

Exceptions

ArgumentNullException

source is null

ArgumentException

sourceis empty.

ChooseUniformRandom<TSource>(IList<IGenerator<TSource>>)

Makes a generator that selects a random generator from a given element to generate an element from.

public static IGenerator<TSource> ChooseUniformRandom<TSource>(IList<IGenerator<TSource>> source)

Parameters

source IList<IGenerator<TSource>>

The list of generators to choose from.

Returns

IGenerator<TSource>

A new generator.

Type Parameters

TSource

The type of elements to generate.

Exceptions

ArgumentNullException

list is $(null).

ArgumentException

list is empty or has null elements.

ChooseUniformRandom<TSource>(params IGenerator<TSource>[])

Chooses the from the given generators selected uniform randomly.

[Obsolete("Use an appropriate overload instead.")]
public static IGenerator<TSource> ChooseUniformRandom<TSource>(params IGenerator<TSource>[] source)

Parameters

source IGenerator<TSource>[]

Returns

IGenerator<TSource>

IGenerator<TSource>.

Type Parameters

TSource

ChooseUniformRandom<TSource>(IList<IGenerator<TSource>>, int)

Chooses the random.

public static IGenerator<TSource> ChooseUniformRandom<TSource>(IList<IGenerator<TSource>> source, int seed)

Parameters

source IList<IGenerator<TSource>>

The list.

seed int

The seed.

Returns

IGenerator<TSource>

IGenerator<TSource>.

Type Parameters

TSource

The type of the t source.

Exceptions

ArgumentNullException

list is $(null).

ArgumentException

list is empty or has null elements.