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)
:afrog:
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:check:
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.
Re: A random word generator?
Quote:
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.
Re: A random word generator?
I finished my gen. :D It generates random passwords. I didn't say that because I was worried you guys would take it wrong. Lol
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.
:D
Re: A random word generator?[resolved]
Aw. Apparently its a invalid file. Here's the media fire link:
http://www.mediafire.com/?nmlgdnkzmzv
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)