Get random number in asp.net C#

I am explaining here with an example to get randon numbers in asp.net. See below example which will return two digit number between 10 to 98. You can change numbers (n numbers of digit) according to your requirement.
//namespace
using System;
private int GetRandomNumbers()
{
    Random objRan = new Random();
    int randomNumber = 0;
    randomNumber = objRan.Next(10, 99);
 
    return randomNumber;
}
 
//Output: 24

 Posted Comments

No comments have been posted to this article.

 Post a comment

Name:
Email:
Comment:
Security Code:
45 + 69
=
We don't publish your email on our website.