Print Page | Close Window

Random Number

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=12712
Printed Date: 30 March 2026 at 11:31pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Random Number
Posted By: zMaestro
Subject: Random Number
Date Posted: 26 November 2004 at 5:57am

What is the simplest way to write a random number between 1 and 30??

I use this code to select a number between 1 and 10.

<%=Int(RND * 10)%>

thanks




Replies:
Posted By: Gullanian
Date Posted: 26 November 2004 at 6:55am
Doesn't changing the 10 to 30 work?


Posted By: theSCIENTIST
Date Posted: 27 November 2004 at 12:04pm
You need to initialize the seed with Randomize, check this:

<% Randomize : Response.Write Int(RND * 30) + 1 %>


-------------
:: http://www.mylittlehost.com/ - www.mylittlehost.com



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net