C# · 12月 20, 2021

C# — 随机数(Random)的使用

使用随机数产生一组大乐透号码

1. C#代码

Console.WriteLine( List listRed = List Random rangdomRed = ( i = ; listRed.Count < ; i++ redNum = rangdomRed.Next(, (! Console.Write( Console.WriteLine( List listBlue = List Random rangdomBlue = ( i = ; listBlue.Count < ; i++ blueNum = rangdomBlue.Next(, (! Console.Write( Console.WriteLine( ( i = ; i < listRed.Count; i++ Console.Write( ( i = ; i < listBlue.Count; i++ Console.Write( Console.ReadKey();

2. 运行结果