C# 生成随机数的代码片段

From , 4 Years ago, written in C#, viewed 49 times.
URL https://pastebin.vip/view/48a79bcf
  1. using System;
  2.  
  3. class Program
  4. {
  5.    private Random random = new Random();
  6.  
  7.    private int RandomNumber (int min, int max)
  8.    {
  9.       return random.Next (min, max);
  10.    }
  11.  
  12.    public static void Main(string[] args)
  13.    {
  14.       Program program = new Program();
  15.       for (int i = 0; i <= 10; i++)
  16.       {
  17.          Console.WriteLine (program.RandomNumber(1, 100));
  18.       }
  19.  
  20.       Console.ReadKey(); // wait so you have time to see the output
  21.    }
  22. }
  23. //csharp/4160

Reply to "C# 生成随机数的代码片段"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website