Online list of Random words?
I am trying to get a random word in VB and was wondering if it was possible to do this through the internet some how? For example If there was a website that literally just contains random words (anything over 100 will do) and I could just select a random word from it?
I can create random letters and numbers but I want a word that would be in a dictionary.
Thanks
Re: Online list of Random words?
First you need to get a list (textfile, whatever) of the dictionary, then have a look at this:
http://www.dreamincode.net/forums/to...m-a-text-file/
vb.net Code:
Dim ioFile As New StreamReader("sayings.txt")
If File.Exists("sayings.txt") Then
'StreamReader to read our file
'Generic list for holding the lines
Dim lines As New List(Of String)
'Random class to generate our random number
Dim rnd As New Random()
'Variable to hold our random line number
Dim line As Integer
'Now we loop through each line of our text file
'adding each line to our list
While ioFile.Peek <> -1
lines.Add(ioFile.ReadLine())
End While
'Now we need a random number
line = rnd.Next(lines.Count + 1)
'Now write out the random line to the TextBox
RichTextBox1.AppendText(lines(line).Trim())
'Close our StreamReader
ioFile.Close()
'Dispose of the instance
ioFile.Dispose()
Else
ioFile.WriteLine("Chinese words here")
ioFile.WriteLine("Chinese words here")
ioFile.WriteLine("Chinese words here")
ioFile.Close()
End If
Re: Online list of Random words?
Thank you, do you know of anywhere I could find a dictionary/list to use?
Also would that method work if the file was hosted online and I pointed the file location to the online location?
Eg, If www.website.com/dictionary.txt Exists Then .........
Thanks
Re: Online list of Random words?
I wouldn't do that. The textfile will be downloaded each time.
The only way I can think at the moment is to create a server-table an add the wordlist into it.
Re: Online list of Random words?
look for ogdens english, it is a system with 800 to 1500 words in lists, he believed you only needed 800 words to be able to talk about anything in english and 1500 to be elequent.
the files there would be good for your task i think.
link here
http://ogden.basic-english.org/words.html
here to help
Re: Online list of Random words?
Thank you, I have heard of that somewhere before.
I will try it later and let you know how I get on