C# Program to Generate Random Number

Introduction

This program developed using C# , .NET Framework and Visual Studio demonstrates how to generate random number in C#.

C# Program to Generate Random Number

using System;

namespace GinktageConsoleApp
{
    internal class Program
    {
        private static Random randomNumber = new Random();

        private static void Main(string[] args)
        {
            int output = randomNumber.Next();
            Console.WriteLine(output);
            Console.ReadLine();
        }
    }
}

image

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Reply


x

Interesting BlogPosts to read

Web Summit 2016 - Student Scholarship Program
WebSummit is one of the popular conferences and this year , it is scheduled to be held from LISBON, ...
How to perform Shallow Copy in C# ? by @abundantcode
To perform Shallow copy in C# , you can use the this.MemberwiseClone() method. How to perform Shall...
How to add entries to ResourceDirectory in WPF using C# ?
Below is a sample code snippet demonstrating how the entries can be added to the ResourceDirectory i...