Get Random number : Random : Development Class C# Source Code


Custom Search

C# Source Code » Development Class » Random »

 

Get Random number








    
 
using System;

class CondOpApp {
    [STAThread]
    static void Main(string[] args) {
        Random rand = new Random();
        int a = 0, b = 0;

        for (int i = 0; i < 5; i++) {
            a = rand.Next() % 100;
            b = rand.Next() % 100;

            Console.WriteLine("a={0}, b={1}, so the winner is: {2}", a, b, a > b ? 'a' : 'b');
        }
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Development Class
» Random