ASP generates a random number that is not duplicated

Source: Internet
Author: User
Random | random number | repeat
Sub Calcapiao ()
Dim Strcaipiaonoarr () as String
Dim strSQL as String
Dim Strcaipiaono as String
Strcaipiaono = "01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,
17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33 "

Dim Strtemparr (7) as String
Dim Strzhongjiangarr (7) as String
Strcaipiaonoarr = Split (Strcaipiaono, ",")
Dim Intrand as Integer
Dim I as Integer
Dim J as Integer
i = 0
Dim Find as Boolean
Do While True
Find = False
Randomize
Intrand = Int ((Rnd) + 1)
For j = 0 to I-1
If Strtemparr (j) = CStr (Intrand) Then
Find = True
End If
Next
If not find Then
Strtemparr (j) = CStr (Intrand)
Strzhongjiangarr (i) = CStr (Intrand)
' Text1 (i) = Strzhongjiangarr (i)

i = i + 1
If i = 7 Then
Exit do
End If
End If
Loop
End Sub



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.