PDA

View Full Version : Randomly Generate Lotto Number Picks


admin
06-05-2003, 02:06 PM
Dont trust that State-run quick pick lottery function, who can say they are REALLY random?

Hand-write your selections in the lottery sign-up card using the following...


<%
Sub jdSort(vec,loBound,hiBound)
Dim pivot,loSwap,hiSwap,temp

if hiBound - loBound = 1 then
if vec(loBound) > vec(hiBound) then
temp=vec(loBound)
vec(loBound) = vec(hiBound)
vec(hiBound) = temp
End If
End If

pivot = vec(int((loBound + hiBound) / 2))
vec(int((loBound + hiBound) / 2)) = vec(loBound)
vec(loBound) = pivot
loSwap = loBound + 1
hiSwap = hiBound

do
while loSwap < hiSwap and vec(loSwap) <= pivot
loSwap = loSwap + 1
wend
while vec(hiSwap) > pivot
hiSwap = hiSwap - 1
wend
if loSwap < hiSwap then
temp = vec(loSwap)
vec(loSwap) = vec(hiSwap)
vec(hiSwap) = temp
End If
loop while loSwap < hiSwap

vec(loBound) = vec(hiSwap)
vec(hiSwap) = pivot

if loBound < (hiSwap - 1) then _
Call jdSort(vec,loBound,hiSwap-1)
if hiSwap + 1 < hibound then _
Call jdSort(vec,hiSwap+1,hiBound)
End Sub

Response.Write "<font face='arial' size='2'>" & _
"5 bucks worth of random
numbers" & "</font><br>"

dim theNumber, counter, position, placed
dim orderarray(6), numberarray(6)

for i = 1 to 5
Randomize

theNumber = ""

for j = 1 to 6
numberarray(j) = Int(Rnd*69)
next

Call jdSort(numberarray,1,6)

for z = 1 to 6
theNumber = theNumber & numberarray(z) & " "
next

for x = 1 to 6
for y = 1 to 6
if (x<>y) and (numberarray(x) = numberarray(y)) then _
response.redirect "ran.asp" 'be sure to rename ran.asp
next
next

Response.Write "<font face='arial' size='2'>" & theNumber & _
"</font><br>"
next
%>


By Aaron Gregory