class MainClass
{
public static void Main (string[] args)
{
// Question #3 answer
int number;
int min=20,max=50;
Random RandomNumber = new Random();
for ( number= 20; number<=50; number++)
RandomNumber.Next(20, 50);
Console.WriteLine (number);
}
}
答案 0 :(得分:-1)
你想:
int min=20,max=50;
Random RandomNumber = new Random();
for (var count = 0; count<10; count++)
Console.WriteLine(RandomNumber.Next(min, max));
for循环运行10次迭代,每次迭代Console.WriteLine()
都是min
和max
之间的新随机数。