Generate random number : Random « Development « C# / CSharp Tutorial






using System;  
  
class MainClass {     
  public static void Main() {     
    Random ran = new Random(); 
 
    Console.WriteLine(ran.Next(1, 7));  
  }     
}
6








14.14.Random
14.14.1.Generate random number
14.14.2.Demonstration of predictability (always prints the same thing)