namespace bbbc
{
class Program
{
static void Main(string[] args)
{
int a;
Random n = new Random();
while (true)
{
int[] arr = new int[5];
for (int i = 0; i < 5; i++)
{
a = n.Next(1, 6);
arr[i] = a;
if (arr.Contains(a))
{
arr[i] = a;
}
else
{
a = n.Next(1, 6);
}
Console.WriteLine(arr[i]);
}
break;
}
}
}
}
帮忙看一下,如何让随机数不重复啊,我是新手不会谢谢