Method SampleRandom
- Namespace
- Gamelogic.Extensions.Algorithms
- Assembly
- Gamelogic.Extensions.dll
SampleRandom<T>(IEnumerable<T>, int)
Returns a random sample from a source.
public static IEnumerable<T> SampleRandom<T>(this IEnumerable<T> source, int sampleCount)
Parameters
source
IEnumerable<T>The source from which to sample.
sampleCount
intThe number of samples to return.
Returns
- IEnumerable<T>
Generates a ransom subset from a given source.
Type Parameters
T
The type of elements of the source.
SampleRandom<T>(IEnumerable<T>, int, IRandom)
Returns a random sample from a source.
public static IEnumerable<T> SampleRandom<T>(this IEnumerable<T> source, int sampleCount, IRandom random)
Parameters
source
IEnumerable<T>The source from which to sample.
sampleCount
intThe number of samples to return.
random
IRandomThe random generator to use.
Returns
- IEnumerable<T>
Generates a ransom subset from a given source.
Type Parameters
T
The type of elements of the source.