AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
 random number
Posted by arun gupta on  1/28/2008 5:35:05 AM Category: Asp.Net 2.0
Add to my favorites
Email to friend
here i am making a website online examination system where i generate a random number
to choose random question but from random function after some time question is repeted
may it possible to generate unique number

Post Your Reply Post New Question

 Viewer's Reply
Use .Net Random class
Answered By Moderator1 on 1/28/2008 7:19:27 PM
Hi,

if you use .net frameworks, random class and if you mention the minimim and maximim values, it will not return.. Anyhow the good code is to check the uniqueness. to create a random number in Asp.Net the syntax is given below

Random ran = new Random();
Response.Write(ran.Next(0, 999999).ToString());
 
Post Your Reply If you still have problem, post it again under this reply for better response.

 
Sponsored by
The Art & Science of JavaScript - Free 100 Page Preview!
Integrating Silverlight 4 with SharePoint 2010 - Free 42 Page Sample Chapter
No Nonsense XML Web Development With PHP - Free 146 Page Preview!