Results 1 to 3 of 3

Thread: Generate a Random Integer Between Two Specified Values

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2009
    Posts
    462

    Generate a Random Integer Between Two Specified Values

    how can i do this ? i new how to but i forgot and i need it right now

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2009
    Posts
    462

    Re: Generate a Random Integer Between Two Specified Values

    Sorry NM i got it
    Code:
        Dim RandomClass As New Random()
            Dim RandomNumber As Integer
            RandomNumber = RandomClass.Next()
    
            RandomNumber = RandomClass.Next(textbox1.Text, textbox2.Text)
    
            TextBox3.Text = RandomNumber

  3. #3
    Fanatic Member
    Join Date
    Oct 2008
    Location
    Dominican Republic
    Posts
    733

    Re: Generate a Random Integer Between Two Specified Values

    vb.net Code:
    1. Public Function GetRandomNum
    2. Dim myRandom as New Random
    3. dim RandomNumber as Integer = myRandom.Next('first value, 'sencond value) 'both as integers
    4. Return RandomNumber
    5. End Function
    "In our profession, precision and perfection are not a dispensable luxury, but a simple necessity."
    Niklaus E. Wirth


    Rate any post that helped you, it's a good way of saying thanks
    Please specify your Visual Studio Version!

    Why rating is useful

    My Code Bank Submissions: How to determine Windows Version| Working With Mouse Events | Blocking Input Using API | Get host's IP | Minimize to system tray "animated" | Colored ListBox (custom fonts, colors, highlight) Updated -New Class! | [VS 2008] Strong encryption and hashing class - Updated! 31/August/2009 | Create a shortcut using IWshRuntimeLibrary

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