Click or drag to resize

CombinatoricsSelectVariationT Method

Select a random variation, without repetition, from a data sequence by randomly selecting k elements in random order. Implemented using partial Fisher-Yates Shuffling.

Namespace: Altaxo.Calc
Assembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3179.0 (4.8.3179.0)
Syntax
C#
public static IEnumerable<T> SelectVariation<T>(
	this IEnumerable<T> data,
	int elementsToChoose,
	Random randomSource = null
)

Parameters

data  IEnumerableT
The data source to choose from.
elementsToChoose  Int32
Number of elements (k) to choose from the set. Each element is chosen at most once.
randomSource  Random  (Optional)
The random number generator to use. Optional; the default random source will be used if null.

Type Parameters

T

[Missing <typeparam name="T"/> documentation for "M:Altaxo.Calc.Combinatorics.SelectVariation``1(System.Collections.Generic.IEnumerable{``0},System.Int32,System.Random)"]

Return Value

IEnumerableT
The chosen variation, in random order.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableT. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also