C# random range code example
Example 1: random number generator c#
Random rnd = new Random();
int month = rnd.Next(1, 13);
int dice = rnd.Next(1, 7);
int card = rnd.Next(52);
Example 2: random number generator unity
int num = Random.Range(min, max);
Example 3: unity random int
public int RanTimerHigh = 10;
public int RanTimerLow = 1;
void Start()
{
int RandomInt = Random.Range(RanTimerLow, RanTimerHigh);
}
Example 4: 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 5: unity random range
Random.Range(-10.0f, 10.0f);
Example 6: generate range c#
IEnumerable<int> squares = Enumerable.Range(1, 10).Select(x => x * x);
foreach (int num in squares)
{
Console.WriteLine(num);
}