static void Main(string[] args)
{
Console.WriteLine("请输入n:");
String strInput = Console.ReadLine();
int n = Convert.ToInt32(strInput);
//创建用于产生随机数的Random类
Random rd = new Random();
for (int k = 0; k < n; k++)
{
int temp = rd.Next() % 9999 + 1000;
Console.Write("" + temp + " ");
}
}
运行结果: