110,536
社区成员
发帖
与我相关
我的任务
分享
var res=list.orderBy(c=> Guid.NewGuid()).take(20)
private void button1_Click(object sender, EventArgs e)
{
Random r = new Random(Guid.NewGuid().GetHashCode());
string[] arr = { "2","5","7","1","9","4"};
foreach (string s in arr)
{
int index = r.Next(0, arr.Length);
string strTemp = arr[index];
arr[index] = arr[0];
arr[0] = strTemp;
}
foreach (string s in arr)
{
MessageBox.Show(s);
}
}