Jump to content

  •  

  • iBotModz CBox


    Photo

    Generate random Ascii characters


    • Please log in to reply
    3 replies to this topic

    #1 ixGAMEOVERxixx

    ixGAMEOVERxixx

      Private Grade 2

    • VIP

    • 478 posts
    • Joined: 27-October 08
    • Gender:Not Telling
    • Location:Custom Games

    Posted 20 June 2009 - 01:48 PM

    VB.net

    Use this code to generate random ascii chars, (CODE BY SLIPSTREAM)

    Dim Random As New Random()
       TextBox1.Text = Chr(Random.Next(65, 90)) & Chr(Random.Next(65, 90)) & Chr(Random.Next(65, 90)) & Chr(Random.Next(65, 90))
    And etc...

    Edited by ixGAMEOVERxixx, 20 June 2009 - 02:58 PM.


    #2 iBotPeaches

    iBotPeaches

      General Grade 6

    • Owner

    • 6,570 posts
    • Joined: 29-July 07
    • Gender:Male
    • Location:Kansas

    Posted 20 June 2009 - 01:53 PM

    One thing you can merge multiple declarations if its the same type.

    Dim RandomNumber1, RandomNumber2, RandomNumber3, RandomNumber4 As Integer


    Maybe you can directly put the RandomClass.Next in the Chr instead of the variable you made, not sure though.

    #3 Dark Slipstream

    Dark Slipstream

      Blue Shadowz Owner

    • Members+

    • 2,829 posts
    • Joined: 19-April 08
    • Gender:Male
    • Location:Canada, ON

    Posted 20 June 2009 - 02:00 PM

    :S

    VB.NET
       
       Dim Random As New Random()
       TextBox1.Text = Chr(Random.Next(65, 90)) & Chr(Random.Next(65, 90)) & Chr(Random.Next(65, 90)) & Chr(Random.Next(65, 90))

    C#
     
      Random Rnd = new Random();
       TextBox1.Text = Convert.ToString(Chr(Random.Next(65, 90)) & Chr(Random.Next(65, 90)) & Chr(Random.Next(65, 90)) & Chr(Random.Next(65, 90)));

    Edited by Dark Slipstream, 20 June 2009 - 02:04 PM.


    #4 XeNoS

    XeNoS

      Apprentice Grade 2

    • Members+

    • 26 posts
    • Joined: 25-June 09
    • Gender:Male
    • Location:Germany

    Posted 20 June 2009 - 03:02 PM

    :awesome:
    Thanks