KGy SOFT

EnumerableExtensionsShuffleT Method (IEnumerableT, Random)

KGy SOFT Core Libraries Help
Shuffles an enumerable source (randomizes its elements) using a specified Random instance.

Namespace:  KGySoft.CoreLibraries
Assembly:  KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 5.0.0
Syntax

public static IEnumerable<T> Shuffle<T>(
	this IEnumerable<T> source,
	Random random
)

Parameters

source
Type: System.Collections.GenericIEnumerableT
The IEnumerableT to shuffle its elements.
random
Type: SystemRandom
The Random instance to use.

Type Parameters

T
The type of the elements of source.

Return Value

Type: IEnumerableT
An IEnumerableT which contains the elements of the source in randomized 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).
Exceptions

ExceptionCondition
ArgumentNullExceptionrandom or source is .
See Also

Reference