C#获得随机数

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6 
 7 namespace ConsoleApplication1
 8 {
 9     class Program
10     {
11         static void Main(string[] args)
12         {
13             Random r = new Random();
14             int b = r.Next(0, 9);
15             Console.WriteLine("{0}",b);
16         }
17     }
18 }
Next原型:
1 public virtual int Next(
2     int minValue,
3     int maxValue
4 )

第一个控制最小值,

第二个控制最大值。

原文地址:https://www.cnblogs.com/2016Study/p/5456729.html