-
Mar 1st, 2012, 12:31 PM
#1
Thread Starter
Lively Member
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
-
Mar 1st, 2012, 04:20 PM
#2
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
Last edited by Radjesh Klauke; Mar 1st, 2012 at 04:24 PM.
-
Mar 1st, 2012, 05:19 PM
#3
Thread Starter
Lively Member
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
-
Mar 1st, 2012, 05:28 PM
#4
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.
-
Mar 1st, 2012, 06:36 PM
#5
Frenzied Member
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
-
Mar 2nd, 2012, 04:17 AM
#6
Thread Starter
Lively Member
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
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|