public static void getRand()
{
StreamWriter sw = new StreamWriter(@"C:\Documents and Settings\Administrator\桌面\1.txt");
Random rd = new Random();
ArrayList intTempArr = new ArrayList();
int[] intArr = new int[1000000];
//填充数组intTempArr
for (int i = 1000001; i < 2000001; i++)
{
intTempArr.Add(i);
}
//生成随机数
for (int j = 0; j < intArr.Length; j++)
{
int temp = rd.Next(intTempArr.Count - 1);
int tempValue = (int)intTempArr[temp];
intArr[j] = tempValue;
intTempArr.RemoveAt(temp);
sw.WriteLine(tempValue);
if (j % 10000 == 0)
Console.WriteLine(j);
//Console.Write("intArr[" + j + "]=" + tempValue + "\n\r");
}
sw.Close();
sw.Dispose();
}