c#从数组中随机抽取出一组数据,该怎么处理

如题所述

Random rnd = new Random();
int[] array = new int[] { 2, 3, 10, 13, 9, 7, 20, 19 };
int[] newarray = array.OrderBy(i => rnd.NextDouble()).Take(5).ToArray();//你要取多少数据,就把这行的5改成多少

温馨提示:答案为网友推荐,仅供参考