Permutation.CreateRandom Method

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0

Overload List

CreateRandom(Int32, IRandomSource) Creates a new random permutation of the specified length.
CreateRandom(Int32, Random) Creates a new random permutation of the specified length.
CreateRandom<TGenerator>(Int32, IRandomSource<TGenerator>) Creates a new random permutation of the specified length.

CreateRandom(Int32, IRandomSource)

Creates a new random permutation of the specified length.
C#
public static Permutation CreateRandom(
	int length,
	IRandomSource random = null
)

Parameters

length  Int32
The length of the permutation.
random  IRandomSource  (Optional)
Optional. The random number generator.

Return Value

Permutation
A random permutation of length length.

Exceptions

ArgumentOutOfRangeException

length is less than zero.

CreateRandom(Int32, Random)

Creates a new random permutation of the specified length.
C#
public static Permutation CreateRandom(
	int length,
	Random random
)

Parameters

length  Int32
The length of the permutation.
random  Random
The random number generator.

Return Value

Permutation
A random permutation of length length.

Exceptions

ArgumentOutOfRangeException

length is less than zero.

CreateRandom<TGenerator>(Int32, IRandomSource<TGenerator>)

Creates a new random permutation of the specified length.
C#
public static Permutation CreateRandom<TGenerator>(
	int length,
	IRandomSource<TGenerator> random = null
)
where TGenerator : struct, new(), IRandomGenerator

Parameters

length  Int32
The length of the permutation.
random  IRandomSource<TGenerator>  (Optional)
Optional. The random number generator.

Type Parameters

TGenerator

Return Value

Permutation
A random permutation of length length.

Exceptions

ArgumentOutOfRangeException

length is less than zero.

See Also