Method RepeatEach
- Namespace
- Gamelogic.Extensions.Algorithms
- Assembly
- Gamelogic.Extensions.dll
RepeatEach<TSource>(IGenerator<TSource>, IGenerator<int>)
Makes a new generator that will repeat each of the given generators elements a number of times.
public static IGenerator<TSource> RepeatEach<TSource>(this IGenerator<TSource> generator, IGenerator<int> repeatCountGenerator)
Parameters
generator
IGenerator<TSource>The source generator.
repeatCountGenerator
IGenerator<int>A generator used to get the number of times each element will be generated.
Returns
- IGenerator<TSource>
A new generator.
Type Parameters
TSource
The type of the elements of the source generator.
Exceptions
- ArgumentNullException
generator
- ArgumentNullException
repeatCountGenerator
is null.
RepeatEach<TSource>(IGenerator<TSource>, int)
Makes a new generator that will repeat each of the given generators elements a number of times.
public static IGenerator<TSource> RepeatEach<TSource>(this IGenerator<TSource> generator, int repeatCount)
Parameters
generator
IGenerator<TSource>The source generator.
repeatCount
intThe number of times each element will be generated.
Returns
- IGenerator<TSource>
A new generator.
Type Parameters
TSource
The type of the elements of the source generator.
Exceptions
- ArgumentNullException
generator
is null- ArgumentOutOfRangeException
repeatCount
is not positive.