AlgorithmsRandomShuffleT Method (IEnumerableT, Random) |
Randomly shuffles the items in a collection, yielding a new collection.
Namespace: X3Platform.CollectionsAssembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntaxpublic static T[] RandomShuffle<T>(
IEnumerable<T> collection,
Random randomGenerator
)
public:
generic<typename T>
static array<T>^ RandomShuffle(
IEnumerable<T>^ collection,
Random^ randomGenerator
)
Parameters
- collection
- Type: System.Collections.GenericIEnumerableT
The collection to shuffle. - randomGenerator
- Type: SystemRandom
The random number generator to use to select the random order.
Type Parameters
- T
- The type of the items in the collection.
Return Value
Type:
TAn array with the same size and items as
collection, but the items in a randomly chosen order.
See Also