<%
Dim I
Dim J
Dim HS
Dim he
Dim ls
Dim le
Dim result
Result = ""
HS = 177.
He = 247
Ls = 1, 161
Le = 254
Dim max_num
Max_num= 65536
Randomize
For I = 1 to 4
Temp1 = dec2bin (INT (HE-HS) * RND () + HS)
Temp2 = dec2bin (INT (le-ls) * RND () + ls)
Result = Result & CHR (binarytodecimal (temp1 & temp2)-max_num)
Next
Response. Write result &""
%>
<%
'Below is the function
Public Function dec2bin (mynum) 'decimal to binary
Dim loopcounter
If mynum> = 2 ^ 31 then
Dec2bin = "too big"
Exit Function
End if
Do
If (mynum and 2 ^ loopcounter) = 2 ^ loopcounter then
Dec2bin = "1" & dec2bin
Else
Dec2bin = "0" & dec2bin
End if
Loopcounter = loopcounter + 1
Loop until 2 ^ loopcounter> mynum
End Function
Public Function binarytodecimal (binaryvalue) 'binary to decimal conversion
'Returns the decimal equivalent of a binary number
Dim idx
Dim TMP
Dim result
Dim digits
Digits = Len (binaryvalue)
For idx = digits to 1 step-1
TMP = mid (binaryvalue, idx, 1)
If TMP = "1" then result = Result + 2 ^ (digits-idx)
Next
Binarytodecimal = Result
End Function
%>