Mega Code Archive

 
Categories / C# / Development Class
 

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');         }     } }