1 2 | Random rnd = new Random(); int number = rnd.Next(1, 10); |
1 | int random_number = new Random().Next(1, 10) // Generates a number between 1 to 10 |
1 2 3 4 | 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 |
1 2 3 | 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 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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); } } } |


1 | Math.Max(5, 10); |
1 | Math.Min(5, 10); |
1 | Math.Sqrt(64); |
1 2 | Math.Abs(-4.7); //Output 4.7 |
1 | Math.Round(9.99); //10 , Math.Round(9.99, 2); round till 2nd number after coma |