• CONTEST ALERT - Experience the power of DDR5 memory with Kingston Click for details

Random number in ASP

Status
Not open for further replies.

whoopy_whale

Journeyman
I tried to generate a random number using the following code.
Code:
set util=Server.CreateObject("MSWC.Tools")
num=abs(util.random)
But I get the following error.
Server object error 'ASP 0177 : 800401f3'

Server.CreateObject Failed

/jobinbasani123/picgallery.asp, line 14

Invalid ProgID. For additional information specific to this message please visit the Microsoft Online Support site located at: http://www.microsoft.com/contentredirect.asp.
Is there any other method to generate a random number?
I have a database and the generated number should be less than or equal to the total number of the records in the database.

please help.....
 

Aseem Nasnodkar

In the zone
Yeah there is a easy way to generate a random no.
Go thro my foll code and you can easily understand it.

Code:
<%
Dim Random_Number_Min, Random_Number_Max, Random_Number
Randomize
Random_Number_Min = 1
Random_Number_Max = 49
Random_Number = Int(((Random_Number_Max-Random_Number_Min+1) * Rnd) + Random_Number_Min)
Response.Write(Random_Number)
Response.Write("")
Response.Write("-")
Response.Write("")
%>

N pls switch to PHP. ASP n microsoft sux!

Njoy coding!
 
Status
Not open for further replies.
Top Bottom