7,765
社区成员
发帖
与我相关
我的任务
分享
HashSet<int> hashSet = new HashSet<int>();
Random rand = new Random();
while (true)
{
hashSet.Add(rand.Next(1, 101));
if (hashSet.Count >= 100)
{
break;
}
}
Int32[] a = hashSet.ToArray<int>();
Array.Sort(a);
foreach (Int32 item in a)
{
Console.WriteLine(item.ToString());
}