1、产生指定上限的随机数(如产生100以内的随机数)
Random ran = new Random();
int n = ran.Next(100);
2、产生指定上下限的随机数(如产生100到1000的随机数)
Random ran = new Random();
int n = ran.Next(100, 1000);
1、产生指定上限的随机数(如产生100以内的随机数)
Random ran = new Random();
int n = ran.Next(100);
2、产生指定上下限的随机数(如产生100到1000的随机数)
Random ran = new Random();
int n = ran.Next(100, 1000);