Click or drag to resize

GeneratorChooseTSource Method (IListIGeneratorTSource, IGeneratorInt32)

Makes a generator that uses an index generator to choose a generator to generate an element from.

Namespace:  Gamelogic.Extensions.Algorithms
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
public static IGenerator<TSource> Choose<TSource>(
	IList<IGenerator<TSource>> generators,
	IGenerator<int> indexGenerator
)

Parameters

generators
Type: System.Collections.GenericIListIGeneratorTSource
The source generators.
indexGenerator
Type: Gamelogic.Extensions.AlgorithmsIGeneratorInt32
The index generator.

Type Parameters

TSource
The type of element to generate.

Return Value

Type: IGeneratorTSource
A new generator.
Exceptions
ExceptionCondition
ArgumentNullExceptiongenerators or indexGenerator
ArgumentExceptionCannot contain null elements;generators
Examples
The following generator will interleave the given generators:
//generators is a IEnumerable of generators
var generator = Generator.Choose(generators, Generator.Count(generators.Count());
See Also