!!!随机数生成!!

随机生成器 Random  rand=new Random();
              Int d=rand.Next(3);{随机生成一个不超过三的数}

例子:static void Main(string[] args)
{string[]cellphone=new string[] {"122321341","12453145","18234287234","14420408420","14234243481","14234324","1434234324","321114221","321111212"}

Random rand=new Random();

for(int i=0;i<50;i++)
{
//变慢一些
System.Threading.Thread.Sleep(100);
//随机生成数组下标
int sub=rand.Next(cellphone.Length);
//根据下标取数组的元素值
string s=cellphone[sub];
//显示
Console.Clear();
Console.WriteLine(s);

}
}

  

posted on 2015-10-13 10:21  闫科达  阅读(164)  评论(0编辑  收藏  举报

导航