java,php,asp.net,linux,javascript,mysql,mssql,oracle,编程

随机选取5组彩票asp

转载请注明:http://www.pmjava.com/Article/ShowInfo.asp?ID=56664
Function rndtest(m_count,r_count) ''参数m_count号码总数,r_count为要取出的号码数
dim x,st,i
i
=1
st
=""
do while i<=r_count
randomize
x
=int(rnd*m_count)+1 ''产生1~m_count的随机数
if i=r_count then
if not instr(st,x)>0 then
st
=st&x
i
=i+1
end if
else
if not instr(st,x)>0 then
st
=st&x&","  ''用,分割
i=i+1
end if
end if
if i>=m_count then
exit do ''如果m_count小于r_count将出现死循环,于是判断并跳出循环
end if
loop
rndtest
=st
end function


function sort(ary)'冒泡函数
ck=true
do Until ck = false
ck
=false
For f = 0 to UBound(ary) -1
 
if clng(ary(f))>clng(ary(f+1)) then
   v1
=clng(ary(f))
   v2
=clng(ary(f+1))
   ary(f)
=v2
   ary(f
+1)=v1
   ck
=true
 
end if
next
loop
sort
=ary
end function

for i=0 to 4
Mycount
=rndtest(33,7)
MyArray
=split(Mycount,",")
newArray
=sort(MyArray)
for i2=0 to UBound(newArray)
Response.Write(newArray(i2)
&" ")
next
Response.Write(
"
")
next

posted on 2009-06-10 22:06 rrong_m 阅读(209) 评论(0)  编辑  收藏

<2024年5月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

导航

统计

常用链接

随笔档案

文章分类

文章档案

java编程

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜