Results 1 to 6 of 6

Thread: Online list of Random words?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2011
    Posts
    67

    Question 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

  2. #2
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    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:
    1. Dim ioFile As New StreamReader("sayings.txt")
    2. If File.Exists("sayings.txt") Then
    3.     'StreamReader to read our file
    4.     'Generic list for holding the lines
    5.     Dim lines As New List(Of String)
    6.     'Random class to generate our random number
    7.     Dim rnd As New Random()
    8.     'Variable to hold our random line number
    9.     Dim line As Integer
    10.     'Now we loop through each line of our text file
    11.     'adding each line to our list
    12.     While ioFile.Peek <> -1
    13.         lines.Add(ioFile.ReadLine())
    14.     End While
    15.        
    16.     'Now we need a random number
    17.     line = rnd.Next(lines.Count + 1)
    18.     'Now write out the random line to the TextBox
    19.     RichTextBox1.AppendText(lines(line).Trim())
    20.     'Close our StreamReader
    21.     ioFile.Close()
    22.     'Dispose of the instance
    23.     ioFile.Dispose()
    24. Else
    25.     ioFile.WriteLine("Chinese words here")
    26.     ioFile.WriteLine("Chinese words here")
    27.     ioFile.WriteLine("Chinese words here")
    28.     ioFile.Close()
    29. End If
    Last edited by Radjesh Klauke; Mar 1st, 2012 at 04:24 PM.


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2011
    Posts
    67

    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

  4. #4
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    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.


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

  5. #5
    Frenzied Member
    Join Date
    Nov 2010
    Posts
    1,470

    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

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Dec 2011
    Posts
    67

    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
  •  



Click Here to Expand Forum to Full Width