ASP随机函数问题 菜鸟求助!
来源:百度知道 编辑:UC知道 时间:2024/06/18 17:39:17
这是我编的双色球机选号码,可是看起来不舒服,添乱,编程的原则不就是简洁、实用、幽雅吗?麻烦前辈们看看,可以再简单点吗?
<%
sub shuaxin()
Randomize
a=32
l=13
b=int(a*rnd()+1)
c=int(a*rnd()+1)
d=int(a*rnd()+1)
e=int(a*rnd()+1)
f=int(a*rnd()+1)
g=int(a*rnd()+1)
h=int(a*rnd()+1)
k=int(l*rnd()+1)
if b<>c and b<>d and b<>e and b<>f and b<>g and b<>h and c<>d and c<>e and c<>f and c<>g and c<>h and d<>e and d<>f and d<>g and d<>h and e<>f and e<>g and e<>f and f<>g and f<>h and g<>h then
response.Write("红球:"&b&" "&c&" "&d&" "&e&" "&f&" "&g&"+"&"篮球:" &k)
end if
end sub
%>
<%
sub shuaxin()
Randomize
a=32
l=13
b=int(a*rnd()+1)
c=int(a*rnd()+1)
d=int(a*rnd()+1)
e=int(a*rnd()+1)
f=int(a*rnd()+1)
g=int(a*rnd()+1)
h=int(a*rnd()+1)
k=int(l*rnd()+1)
if b<>c and b<>d and b<>e and b<>f and b<>g and b<>h and c<>d and c<>e and c<>f and c<>g and c<>h and d<>e and d<>f and d<>g and d<>h and e<>f and e<>g and e<>f and f<>g and f<>h and g<>h then
response.Write("红球:"&b&" "&c&" "&d&" "&e&" "&f&" "&g&"+"&"篮球:" &k)
end if
end sub
%>
<%
sub shuaxin()
dim outRed , outBlue , blueBall ,redBall(8) ,a , I
Randomize
a=32
I=13
blueBall =int(I*rnd()+1)
for i=1 to 7
tmp = int(a*rnd()+1)
isSame=false
for j=1 to i-1
if redBall[j]=tmp then isSame=true
next
if isSame=false then
redBall[i] = tmp
else
i = i - 1
end if
next
outBlue = "蓝球:" & blueBall
outRed = "红球:"
for i = 1 to 7
outRed = outRed & redBall & " , "
next
response.write outRed & outBlue
end sub
%>
-----------------------------------------------------------
哈哈,我也这两天写了一个彩码生成程序,与你分享!
妈妈拿我的程序去生成的码去买了一张,中了1000,呵呵!
<html>
<script>
function $(obj){return document.getElementById(ob