C#实现随机洗牌的方法
2021-07-20 17:26
阅读:712
#region 随机洗牌
”);
int[] ints = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 };
List
int[] outs = new int[20];
Random rand = new Random();
for (int i = 0; i
{
int x = rand.Next(list.Count);
outs[i] = list[x];
list.RemoveAt(x);
}
Response.Write(“
”);
foreach (int i in outs)
{
Response.Write(i.ToString() + ” “);
}
#endregion
上一篇:C#控件闪烁的解决方法
评论
亲,登录后才可以留言!