Click or drag to resize

CombinatoricsGeneratePermutation Method

Generate a random permutation, without repetition, by generating the index numbers 0 to N-1 and shuffle them randomly. Implemented using Fisher-Yates Shuffling.

Namespace: Altaxo.Calc
Assembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3179.0 (4.8.3179.0)
Syntax
C#
public static int[] GeneratePermutation(
	int n,
	Random randomSource = null
)

Parameters

n  Int32
Number of (distinguishable) elements in the set.
randomSource  Random  (Optional)
The random number generator to use. Optional; the default random source will be used if null.

Return Value

Int32
An array of length N that contains (in any order) the integers of the interval [0, N).
See Also