Results 1 to 5 of 5

Thread: [2008] Randomness and arrays

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    14

    Question [2008] Randomness and arrays

    Im making a random cipher generator and here's what it looks like:

    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

    This pattern is repeated for the lower case letters, numbers (0-9), and symbols (< > # ...). I all ready have this:

    Code:
    Public Class NcryptKeyGen
        Dim strStatic(92) As String
        Dim strDynamic(92) As String
        Dim Y As Integer = 93
    
        Public Function X() As Integer
            Randomize()
            X = Int(Rnd() * Y)
    
            MsgBox(Y)
        End Function
        Private Sub btnGO_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGO.Click
            MsgBox("Generating code...")
    
            lblGTp.Text = strStatic(X())
            Y = Y - 1
            lblLTp.Text = strStatic(X())
            Y = Y - 1
        End Sub
    The arrays are way too long to post...but they're there. The reason that Y=Y-1 is so that the maximum parameter goes down one each time the function occurs. What i need to do to, is ensure that this remains a function where one value is assigned to one value so that i do not end up with A = @ and A = %. To do this, i believe that i need to delete the value i used to set the text property of a label.

    So, when % is assigned to A (at random), % will no longer be chosen and deleted...which is why the max parameter of the number generator is moved down one each cycle. So, how would i delete the just used element from an array during run time and after the Public Function X() is executed? i would appreciate any help with this matter.
    Last edited by RILEY343; Mar 8th, 2009 at 12:08 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width