CSharp examples for System:Random
Generate Random within a range
using System.IO;/*from w w w .j a v a 2 s .c o m*/ using System.Collections; using System.Text; using System.Linq; using System.Collections.Generic; using System; public class Main{ public static int GenerateRandom(int minValue, int maxValue) { if (minValue <= maxValue) { Random random = new Random(); return random.Next(minValue, maxValue); } else { return 0; } } }