当前位置:首页 > ASP教程 > 应用技巧

如何从数据库中随机取出10条记录的方法

function xipai(mystr) xipai="" if len(mystr)=0 then'如果是空的,那么初试化一付连续的牌 for i=1 to 52 mystr=mystr & " " next end if dim i,x for i=1 to 52 myarry=split(mystr) 'myarry是下标52的数组,前0-51个有效 randomize x=cint(rnd*(ubound(myarry)-1))'前0-51个随便找一个 mystr=replace(mystr, myarry(x) & space(1),"")'从没发的牌中随便挑一张 xipai=xipai & myarry(x) & space(1) next end function function xp(n) mystr="xipai("""")" dim i for i=1 to n mystr="xipai(" & mystr & ")" next 'xp=eval(mystr) xp=eval(mystr) end function document.write "洗牌完美版" & " " document.write "洗一次牌:" & xp(1) & " " document.write "洗两次牌:" & xp(2) & " " document.write "洗三次牌:" & xp(3) & " " document.write "洗一百次牌:" & xp(100) & " " [ctrl+a 全选 注:如需引入外部js需刷新才能执行]

'洗牌 dim n,s,d,p p=52'牌的数量 set d = createobject("scripting.dictionary") do while d.count
【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!