Skip to content

Randomly selecting a word from a text file

vivian maponya

Asked Sep 1, 2005, 5:41 AM EDT3 answers
Share
LinkedInX
Hi everyone I'm still new in the c# programming.Can you please help on how I can randomly select words from a word document??I'm trying a hangman application(a simple one with now paintings) (client/Server)Application What must happen is that, a server must randomly select a word from a word document and display it on a textbox.When the client connect to the server, it must then count the alphabets on the selected word and then but _(according to the word that was selected) for the user to guess the word Thank you in advance

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    is just a small normal one page word document(no big at all) please help
    0
  • 0
    hi

    may be u can make an array of strings of the document file,read the document into string it into
     a string,split the string into an array of strings divided by the " " space character

    then make a random function in the the range from 0:size of the array string 

    make sure that the step of the random is an integer like 1

    when u return the random number return the array index of it 
    0
  • 1 short reply
    • 0
      How large is the text file?
      0