FAtechs is a Web Site where you can find a lot of things related to tech and Education. Our Posts are mostly about Programming, Information, Technology,Software, Reviews & Everything You need to Know. You can also find Books and Novels here. Your appreciation and criticism will be welcomed.
How to use Random Class in C# to Generate Random Numbers? ... Step By Step Tutorial
Using Random Class to Generate Random Numbers in C#:
Here, You will learn how to use Random Class in C# to generate Random numbers. You can use this techniques in games or Programs in which you require some uniqueness. I Personally use this Class in Ludo Game to generate the Dice Outputs.
You can do a number of works by this Class but I am explaining to Generate the Random Numbers.
Code to Generate Random Numbers:
Random random = new Random(); // Making object of Random Class
for (int i = 0; i < 5; i++) // Counter Loop to show result
int number = random.Next(1, 7); // Generating Random Number from 1 to 6 to use in ludo
Console.WriteLine(number); // Writing the output on Console Screen...
Commenting on a post
is a great way to show some love for what you're seeing.