Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rnd Random numbers

Status
Not open for further replies.

Ouch

Programmer
Jul 17, 2001
159
GB
can anyone tell me how to generaate a 8 digit random number?

i have tried <%=Int(Rnd()*10000000)%>
but it doesnt work?

can anyone help me please?
 
Ouch,

the statement <%= something%> is an equivalent to the statement <%Response.Write(something)%> and is used to write something onto the page. So, you should use the normal procedure like:


<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
</HEAD>
<BODY>


<%
Dim rndnum
Randomize
rndnum = Int(Rnd()*(99999999-10000000+1)+10000000) ' generates random 8-digit number in a range between 10000000 and 99999999
%>
<P>
<% =rndnum%></P>

</BODY>
</HTML>


Good luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top