您的位置首页百科知识

求vb随机数代码

求vb随机数代码

Private Sub Command1_Click()Dim min, max, n, i, a()min = Val(Text1)max = Val(Text2)n = Val(Text3)ReDim a(n)RandomizeFor i = 1 To nDoa(i) = Int(Rnd * (max - min + 1)) + minFor j = 1 To iIf a(i) = a(j) And i <巧拿早者> j Then Exit ForNextLoop While j <= iNextOpen "c:\1.txt" For Output As #1Print #1, Join(a, "孝睁搭 ")Close #1End Sub