Generate Random Number in C# Between 1 to 10 – C# Programming Example
C# Console General

Generate Random Number in C# Between 1 to 10

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. The Next method returns a random number, NextBytes returns an array of bytes filled with random numbers, and NextDouble.

 

The following code returns a random number between 1 and 10

 

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: