Click or drag to resize

CombinatoricsSelectCombinationT Method

Select a random combination, without repetition, from a data sequence by selecting k elements in original order.

Namespace: Altaxo.Calc
Assembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3179.0 (4.8.3179.0)
Syntax
C#
public static IEnumerable<T> SelectCombination<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 data 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.SelectCombination``1(System.Collections.Generic.IEnumerable{``0},System.Int32,System.Random)"]

Return Value

IEnumerableT
The chosen combination, in the original 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