Random rnd = new Random();
int number = rnd.Next(1, 10);
int random_number = new Random().Next(1, 10) // Generates a number between 1 to 10
Random rnd = new Random();
int month = rnd.Next(1, 13); // creates a number between 1 and 12
int dice = rnd.Next(1, 7); // creates a number between 1 and 6
int card = rnd.Next(52); // creates a number between 0 and 51
Random rnd = new Random();
int value = rnd.Next(min,max);
Console.Write(value); //Write - text continues after shown variable, WriteLine - sets line and continues in new line
using System;
namespace Any_function
{
internal class Program
{
static void Main(string[] args)
{
Random rnd = new Random();
int value = rnd.Next(0, 100);
Console.WriteLine(value);
}
}
}
WriteLineWrite
Math.Max(5, 10);
Math.Min(5, 10);
Math.Sqrt(64);
Math.Abs(-4.7);
//Output 4.7
Math.Round(9.99); //10 , Math.Round(9.99, 2); round till 2nd number after coma