vb 随机获取6个1-33的数

    Private Sub random(ByVal num As Integer, ByVal min As Integer, ByVal max As Integer)
        Dim i As Integer = 1
        Dim number As Integer
        Dim numbers As String = ""
        While i <= num
            number = CInt(Rnd() * (max - min + 1) + 1)
            While InStr(numbers, "'" + CStr(number) + "'") > 0
                number = CInt(Rnd() * (max - min + 1) + 1)
            End While
            numbers += "'" + CStr(number) + "',"
            i += 1
        End While
    End Sub

你可能感兴趣的:(vb)