c# random number in range code example
Example 1: c# random int
Random rnd = new Random();
int number = rnd.Next(1, 10);
Example 2: c# random number
int random_number = new Random().Next(1, 10)
Example 3: c# generate random int in range
Random r = new Random();
int rInt = r.Next(0, 100);
int range = 100;
double rDouble = r.NextDouble()* range;
Example 4: generate range c#
IEnumerable<int> squares = Enumerable.Range(1, 10).Select(x => x * x);
foreach (int num in squares)
{
Console.WriteLine(num);
}