Results 1 to 7 of 7

Thread: A random word generator?[resolved]

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2009
    Posts
    12

    Resolved A random word generator?[resolved]

    I want to make a random word generator. Like just the words that I type in the script though. Could anyone please give me the code?
    It would just be a simple word that appears in a text box. But in the script it puts one of the random words i tell it to every time you click the button. I know lua 5.1 scripting a little. I'm only 13 though. So as you can imagine I'm no mastermind at code. You would put something like this in lua:

    button1 function onclick
    print word.math;random(word1,word2,word3,etc)




    I would enjoy it if someone could just post the code. I'm sure it's quite easy to make. I'm just new to this language. Thanks
    Last edited by Turtleman924; Dec 23rd, 2009 at 03:57 AM. Reason: [Resolved]

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: A random word generator?

    Whenever you want something random in VB, you are pretty much always going to use a Random object. You call Next on that object to get a random Integer in a range, then use that Integer in whatever way is appropriate. In your case, that would mean indexing an array or collection containing all you words.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Re: A random word generator?

    I'm only 13 though.
    Big deal! I'm only 16 yet I know the language semi-decently.

    What you're asking is quite similar to how you'd do it in LUA. I won't program this for you, instead I'll do a bit of Psuedo-Code.

    Code:
    Declare Array of Words() [Call it Words()]
    Declare Random Object   [Call it RNM]
    Declare Integer             [Call it i]
    i = RNM.Next()
    Declare Current Word [call it CurrWord]
    CurrWord = Words(i)
    There you go. Something like that.

  4. #4

    Thread Starter
    New Member
    Join Date
    Dec 2009
    Posts
    12

    Resolved Re: A random word generator?

    I finished my gen. It generates random passwords. I didn't say that because I was worried you guys would take it wrong. Lol

  5. #5

    Thread Starter
    New Member
    Join Date
    Dec 2009
    Posts
    12

    Talking Re: A random word generator?[resolved]

    Here is the file: (you probably won't find it useful. But its one of my first programs ever wrote)


    Even made a icon for it. I feel so special lol.


  6. #6

    Thread Starter
    New Member
    Join Date
    Dec 2009
    Posts
    12

    Re: A random word generator?[resolved]

    Aw. Apparently its a invalid file. Here's the media fire link:

    http://www.mediafire.com/?nmlgdnkzmzv

  7. #7
    Hyperactive Member gonzalioz's Avatar
    Join Date
    Sep 2009
    Location
    <body></body>
    Posts
    508

    Re: A random word generator?[resolved]

    Hi Turtleman,

    Just an idea:

    You could use Chr or Chrw with a random number to get random characters. Example:

    This would generate 10 different characters:
    Code:
            Dim random As New Random
            Dim password As New Text.StringBuilder
    
            For i As Int32 = 0 To 9
                password.Append(Chr(random.Next(65, 90)))
            Next
    
            MsgBox(password.ToString)

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