Enumerable.Shuffle<TSource>(IEnumerable<TSource>) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
随机排列序列元素的顺序。
public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::IEnumerable<TSource> ^ Shuffle(System::Collections::Generic::IEnumerable<TSource> ^ source);
public static System.Collections.Generic.IEnumerable<TSource> Shuffle<TSource>(this System.Collections.Generic.IEnumerable<TSource> source);
static member Shuffle : seq<'Source> -> seq<'Source>
<Extension()>
Public Function Shuffle(Of TSource) (source As IEnumerable(Of TSource)) As IEnumerable(Of TSource)
类型参数
- TSource
的元素 source的类型。
参数
- source
- IEnumerable<TSource>
要随机排列的值序列。
返回
IEnumerable<TSource>
一个序列,其元素按随机顺序对应于输入序列的元素。
注解
随机化是使用非加密安全的随机数生成器执行的。