Ad

Saturday, July 6, 2013

Program To Generate a Random Number Using C#.Net?


Overview:
                 In this article i would like to publish an article "To Generate a Random Number". 

Description:
                    In C#.Net we have an Random Class that class consists of 3 overloaded methods.Those are

  1. Next()
  2. Next(MaxValue)
  3. Next(MinValue,MaxValue)
E.G:
        Next() If we uses this method it gives any random value
        Next(MaxValue) If we uses this method it gives upto the given max value range
        Next(ManValue,MaxValue) If we uses this method it gives in between min and given max values range.

Intialization of Random Class:

                                     Random O=new Random();

Program:

Random Number Generation1

Random Number Generation2

No comments: