The Random class of .NET class library provides functionality to generate random numbers in C#
The Random class has three public methods – Next, NextBytes, and NextDouble. NextDouble returns a random number between 0.0 and 1.0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
class Program { static void Main(string[] args) { Random random = new Random(); double number = random.NextDouble(); Console.WriteLine(number); Console.ReadLine(); } } |