本站为一个技术型PHP个人门户站,提供一些代码,技术文章、免费空间消息信息、让学习编程更轻松和不要钱买空间更方便-PHP小戴
你当前的位置:首页>>技术文章>>asp技术文章

asp随机不重复函数

  • 任何写ASP随机而用不重复数字的函数呢?下面这个函数应该是可以。大家可以那去用用看。看是否成功!

    <script language="vbscript">

    Function GetrndNumber(intStart,intEnd,intCount)
         Rem 取指定范围内不同的随机整数
         Rem intStart:起始值
         Rem intEnd:结束值
         Rem intCount:值个数
         Rem no_mIss
         Rem 调用:GetrndNumber(1,9,5)
         On error resume next
         Dim i,reValue,strreValue
         reValue = "" : strreValue = ","
         If Not isNumeric(intStart) or Not isNumeric(intEnd) _
               or Not isNumeric(intCount)  Then Response.write "参数错误!" : Response.End
         If intCount>(intEnd - intStart)+1 Then Response.write "参数错误!" : Response.End
         randomize
         For i = 0 to intCount - 1
               reValue = Int((intEnd - intStart + 1) * Rnd + intStart)
               If instr(strreValue,"," & reValue & ",")>0 Then
                     i = i - 1
               Else
                     strreValue = strreValue & reValue & ","
               End If
         Next
         strreValue = left(strreValue,len(strreValue) - 1)
         strreValue = Replace(strreValue,",","",1,1)
         GetrndNumber = strreValue
    End Function

    </script>


  • [时间:2008-12-10 16:54:14][点击:]

  • 上下篇文章加载中...
本站关键字:宁波网络公司/宁波网站建设公司/宁波网站制作公司/宁波做网站公司