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
sourceIList<TSource>The source list.
Returns
- IGenerator<TSource>
A new generator.
Type Parameters
TSourceThe type of elements to generate.
Exceptions
- ArgumentNullException
sourceis 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
Returns
- IGenerator<TSource>
A new generator.
Type Parameters
TSourceThe type of elements to generate.
Exceptions
- ArgumentNullException
sourceis 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
sourceIList<IGenerator<TSource>>The list of generators to choose from.
Returns
- IGenerator<TSource>
A new generator.
Type Parameters
TSourceThe type of elements to generate.
Exceptions
- ArgumentNullException
listis $(null).- ArgumentException
listis 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
sourceIGenerator<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
sourceIList<IGenerator<TSource>>The list.
seedintThe seed.
Returns
- IGenerator<TSource>
IGenerator<TSource>.
Type Parameters
TSourceThe type of the t source.
Exceptions
- ArgumentNullException
listis $(null).- ArgumentException
listis empty or has null elements.