1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 5 public class Program 6 { 7 public static void Main() 8 { 9 var PinCode = new Random().Next(100000, 999999).ToString(); 10 Console.WriteLine(PinCode); 11 PinCode = new Random().Next(100000, 999999).ToString(); 12 Console.WriteLine(PinCode); 13 PinCode = new Random().Next(100000, 999999).ToString(); 14 Console.WriteLine(PinCode); 15 PinCode = new Random().Next(100000, 999999).ToString(); 16 Console.WriteLine(PinCode); 17 PinCode = new Random().Next(100000, 999999).ToString(); 18 Console.WriteLine(PinCode); 19 PinCode = new Random().Next(100000, 999999).ToString(); 20 Console.WriteLine(PinCode); 21 PinCode = new Random().Next(100000, 999999).ToString(); 22 Console.WriteLine(PinCode); 23 24 var r =new Random(); 25 26 Console.WriteLine("***********************"); 27 PinCode = r.Next(100000, 999999).ToString(); 28 Console.WriteLine(PinCode); 29 PinCode = r.Next(100000, 999999).ToString(); 30 Console.WriteLine(PinCode); 31 PinCode = r.Next(100000, 999999).ToString(); 32 Console.WriteLine(PinCode); 33 PinCode = r.Next(100000, 999999).ToString(); 34 Console.WriteLine(PinCode); 35 Console.WriteLine("***********************"); 36 37 r =new Random(Guid.NewGuid().GetHashCode()); 38 39 PinCode = new Random(Guid.NewGuid().GetHashCode()).Next(100000, 999999).ToString(); 40 Console.WriteLine(PinCode); 41 PinCode = new Random(Guid.NewGuid().GetHashCode()).Next(100000, 999999).ToString(); 42 Console.WriteLine(PinCode); 43 PinCode = new Random(Guid.NewGuid().GetHashCode()).Next(100000, 999999).ToString(); 44 Console.WriteLine(PinCode); 45 PinCode = new Random(Guid.NewGuid().GetHashCode()).Next(100000, 999999).ToString(); 46 Console.WriteLine(PinCode); 47 } 48 49 }
運行結果:dom
523298ide