示例#1
0
 public static IEnumerable <T> RandomShuffle <T>(this IEnumerable <T> source)
 {
     return(source.Select(x => new { Index = StaticRandom.Next(999999999), T = x }).OrderBy(x => x.Index).Select(x => x.T));
 }
示例#2
0
 public static T GetRandom <T>(this IEnumerable <T> source)
 {
     return(source.ElementAt(StaticRandom.Next(source.Count())));
 }