Codefixer - ASP tutorials, resources and software
ASP.NET 3.5/2.0 Hosting – Click Here
Home   Articles   Resources   ASP directory   ASP Tutorials   Code Snippets   ASP Applications   Forum
Saturday 5 July
MembersPro PayPal - ASP Membership software

asp.netPRO “Best ASP.NET Host” – DiscountASP.NET


ASP Partner ASP Partner ASP Partner more partners...

Generate a Random Number between 2 Specified Numbers

The code below will produce a random number between 2 specified numbers. In the code below we set the lowest number to 3 and the highest number to 8. So our code below will assign the value 3, 4, 5, 6, 7 or 8 to the variable randomNum and then be displayed on our screen.

<%
Dim randomNum, highestNumber, lowestNumber
lowestNumber=3
highestNumber=8
RANDOMIZE
randomNum= Int((highestNumber - lowestNumber + 1) * Rnd + lowestNumber)
response.write randomNum
%>

The code above produces this result:

6

You can change the value of lowestNumber and highestNumber to suit your purposes.

LinksPro - Directory  and Link  Management Software




ASP.NET 3.5/2.0 Web Hosting: 3 Months FREE – Click Here!




About | Contact | Advertise | Feedback | Hire Us | Link

Site developed by Michael Wall - Web Design Belfast N.Ireland.
Copyright © 2000-2008. All rights reserved.

Do you intend to move to ASP.NET or have you already?
Yes will do
Have done
ASP does fine
Not a priority


Directory Software