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:
5You can change the value of lowestNumber and highestNumber to suit your purposes.
Get the best asp web hosting provider now and save 30%
Plug and play ASP membership script that integrates with PayPal to let you charge recurring membership fees.