将1-1000区间的数分配给数组,要求不能有重复的值
public static void SetArray(int[] arrayint)
{
// int[] arrayint = new int[100];
Random random = new Random();
for (int i = 1; i <= 1000; i++)
{
int index = random.Next(0, 1000);
if (arrayint[index] == 0)
arrayint[index] = i;
else i--;
}
foreach (int i in arrayint)
{
Console.Write(i);
Console.Write("\t");
}
}