1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Threading.Tasks;
6
7 namespace ConsoleApplication1suijishu
8 {
9 class Program
10 {
11 static void Main(string[] args)
12 {
13 Random rand = new Random();
14 int irand = 0;
15 double drand = 0;
16 for (int i = 0; i < 100; i++)
17 {
18 irand = rand.Next(10,10);//随机0-10之间整数
19 Console.Write(irand+" ");
20 if (i%10==0 && i>9)
21 {
22
23 Console.WriteLine();
24 }
25
26 }
27 Console.WriteLine("---------------------------");
28 for (int i = 0; i < 100; i++)
29 {
30 drand = rand.NextDouble();//随机0-1之间double数
31 Console.Write(drand+" ");
32 if (i % 10 == 0 && i > 9)
33 {
34
35 Console.WriteLine();
36 }
37 }
38 Console.WriteLine("---------------------------");
39 for (int i = 0; i < 100; i++)
40 {
41 drand = rand.NextDouble();
42 Console.Write(Math.Round( drand,4)+" ");//保留4位小数点后数字
43 if (i % 10 == 0 && i > 9)
44 {
45
46 Console.WriteLine();
47 }
48 }
49 Console.WriteLine("---------------------------");
50
51 rand = new Random(System.DateTime.Now.Millisecond);
52 for (int i = 0; i < 100; i++)
53 {
54 drand = rand.NextDouble();
55 Console.Write(Math.Round(drand, 4) + " ");//保留4位小数点后数字
56 if (i % 10 == 0 && i > 9)
57 {
58
59 Console.WriteLine();
60 }
61 }
62
63 Console.ReadKey();
64 }
65 }
66 }