Bueno...ya que no quieres comenzar con la idea, aqui te dejo el inicio:
Código:
<!--#include file = "../datastore.asp"-->
<%
Class RandomRS
'==========================================================
Private Function RandomPwd ( length, repeat )
'----------------------------------------------------------
Dim vPass(), I, J ' our vector plus two counters
Dim vNumbers() ' vector to store
Dim n, bRep
Dim vChars ' vector where possible chars are
vChars = Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0")
'Vector's length
Redim vPass(Length-1)
'Y del vector auxiliar que guarda los caracteres ya escogidos
Redim vNumbers(Length-1)
I = 0
'Starting random
Randomize
'Till if finds all of the chars
do until I = length
'Finding a numbre between 0 & the maximum number
' from the char's vector
n = int(rnd*Ubound(vChars))
'If can't repeat...
if not Repeat then
bRep = False
'Looking for the number among the chosen ones
for J = 0 to UBound(vNumbers)
if n = vNumbers(J) then
'If it's there, we point it
bRep = True
end if
next
'If it was there, we need to repeat it
if bRep then
I = I - 1
else
vNumbers(I) = n
vPass(I) = vChars(n)
end if
else
'I don't care if it's repeated
vNumbers(I) = n
vPass(I) = vCaracteres(n)
end if
'Next Char!
I = I + 1
loop
'Returning the string. Joining the array's indexes
'Let's use the second parameter as a separator, nothing in this case -> "".
RandomPwd = Join(vPass, "")
End Function 'Random Pwd
'==========================================================
Public Function GetRandomRS(qry)
Dim ObjConn
Dim rs
Dim cmd
Dim arrRandom
Dim mtxRandom
Dim j
Set ObjConn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
Set cmd = Server.CreateObject("ADODB.Command")
ObjConn.Open strConnect
cmd.ActiveConnection = ObjConn
cmd.CommandType = adCmdText
cmd.CommandText = qry
rs.CursorType = 3
rs.Open cmd
if not rs.EOF then
arrRandom = rs.GetRows()
Redim mtxRandom(uBound(arrRandom,2), 1)
For j = 0 to uBound(arrRandom,2)
mtxRandom(j,0) = RandomPwd(4, false)
mtxRandom(j,1) = arrRandom(0,j)
Next
arrRandom = mtxRandom
erase mtxRandom
else
arrRandom = ""
end if
GetRandomRS = arrRandom
End Function
End Class
Set ObjRandom = New RandomRS
ds = ObjRandom.GetRandomRS("SELECT notice_id FROM tbl_notice WHERE notice_live=1")
if isArray(ds) then
For i = 0 to uBound(ds)
Response.Write(ds(i,0) & " | " & ds(i,1) & "<br>")
Next
else
response.Write("no")
end if
%>
El include solo tiene el string de conexion
hice una clase para que sea mas facil de modificar, son basicamente dos funciones, la primera la tome hace mucho tiempo no me acuerdo de donde je je, pero es la que tiene el chiste de randomizar numeros, recibe la longitud del numero y un booleano, si se repite o no.
La segunda funcion recibira el query para ejecutar el recordset, despues creamos el recordset, utilizamos un vector mediante getrows y mediante el uso de una matriz llenamos sus dos columnas, en la columna 0, un numero aleatorio, en la columna 1, el id del recordset en turno.
Al final evaluamos si es arreglo lo que devolvio la funcion, e imprimimos sus indices para ver la randomizacion(esa palabra no existe creo

nunca acabare de aprender el ingles y el espanol se me esta olvidando), bueno, lo que faltaria es mediante un algoritmo ordenar los indices, por ahi hay posts del master AZ utilizando quicksort, el resultado es que tendras una matriz ordenada de acuerdo a un numero aleatorio, con los indices de tu recordset...
Felices lineas! je je je