TAV3RN
03-18-2008, 10:57 AM
Hi im trying to get a script to randomize 2 numbers then compare the 2 numbers, if the 2 numbers are the same i want the script to randomize the second number again until it is not the same. below is the code i have at the moment which seemed to crash iis. could somebody please point me in the right direction with this. thanks.
<%
dim gallery(5)
gallery(0) = "0.jpg"
gallery(1) = "1.jpg"
gallery(2) = "2.jpg"
gallery(3) = "3.jpg"
gallery(4) = "4.jpg"
Function RandomNumber(intHighestNumber)
Randomize
RandomNumber = Int(intHighestNumber * Rnd) - 1 + 1
End Function
Dim strRandomgallery1, strRandomgallery2
strRandomgallery1 = gallery(RandomNumber(5))
strRandomgallery2 = gallery(RandomNumber(5))
if strRandomgallery1 = strRandomgallery2 then
do until strRandomgallery1 <> strRandomgallery2
strRandomgallery2 = gallery(RandomNumber(5))
if strRandomgallery1 <> strRandomgallery2 then exit do
loop
end if
response.Write(strRandomgallery1)
response.Write("<br />" & strRandomgallery2)
%>
<%
dim gallery(5)
gallery(0) = "0.jpg"
gallery(1) = "1.jpg"
gallery(2) = "2.jpg"
gallery(3) = "3.jpg"
gallery(4) = "4.jpg"
Function RandomNumber(intHighestNumber)
Randomize
RandomNumber = Int(intHighestNumber * Rnd) - 1 + 1
End Function
Dim strRandomgallery1, strRandomgallery2
strRandomgallery1 = gallery(RandomNumber(5))
strRandomgallery2 = gallery(RandomNumber(5))
if strRandomgallery1 = strRandomgallery2 then
do until strRandomgallery1 <> strRandomgallery2
strRandomgallery2 = gallery(RandomNumber(5))
if strRandomgallery1 <> strRandomgallery2 then exit do
loop
end if
response.Write(strRandomgallery1)
response.Write("<br />" & strRandomgallery2)
%>