2011年6月16日木曜日

→→→乱数を作成

乱数を作成するときの資料用

Int(Rnd() * 55 ) + 1


ArrayListの数の分だけ55のところに数字を入れる


------------------------------------------------------------------



 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim ans, j As Integer
        Dim kigo As New ArrayList(New String() {"a", "b", "c", "d", "e", "f", "g", "h", "j", "k", "m", _
                                                "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", _
                                                "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", _
                                                "n", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", _
                                                "z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "M", "N"})
        Dim strOcc(7) As String
        Dim result As String = ""
        ReDim pInfo(10).str(7)       


        For i As Integer = 0 To 10
            For j = 0 To 7
                ans = Int(Rnd() * 45) + 1
                strOcc(j) = kigo(ans)
                result = String.Concat(strOcc)            
            Next
            pInfo(i).str(j) = result
        Next

        For i = 0 To 10
            For j = 0 To 7
                PWrite(10, 7)
            Next
        Next
 End Sub


----------------------------------------------------------------------
Private Function Pass( ByRef result As String )
       Dim ans  As Integer
       Dim Kigo As New ArrayList( New String() { "a" , "b" , "c" , "d" ,.....(使用する単語)})
       Dim password(7) As String
       For i = 0  To 6
            ans = Int( Rnd() * 45 ) + 1
            password(i) = Kigo( ans )
            result = String.Concat(Password)
       Next
       Return result
End Function

0 件のコメント:

コメントを投稿