ArrayList list = new ArrayList();
Random rd = new Random(); for (int i = ; i <; i++)
{
int rNumber = rd.Next(, );
//是否包含当前数字
if (!list.Contains(rNumber))
{
list.Add(rNumber);
}
else {
i--;
} } for (int i = ; i < list.Count; i++)
{
Console.WriteLine(list[i]);
}
Console.ReadKey();
05-06 06:09