Below is a sample code snippet that shows how to get a random number in C#.
How to Get the Random Number in C# ?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AbundantcodeConsoleApp
{
internal class Program
{
private static void Main(string[] args)
{
// How to Get the Random Number in C# ?
Random random = new Random();
int randomNumber = random.Next();
Console.WriteLine(randomNumber);
Console.ReadLine();
}
}
}
Leave a Reply