• Post Reply Bookmark Topic Watch Topic
  • New Topic

Printing randomly chosen words from a file  RSS feed

 
Karol Klonowski
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i've gotta problem with it. i tried to use BufferedReader and then StringTokenizer, and than use a loop that will run random times, but it didn't work how i expected. I want to read whole file and print out couple of randomly chosen words :\
i've just started programming in java, and feel a bit lost in all this, sorry if it's a silly question

Before that, i tried with streamtokenizer, it compiles and runs but the words chosen by programm are really strange, like: "In and honour you here here peace honour In " and so on, some words are chosen lots of times.

In and honour you here here peace honour In

so, code looks like that:


[ February 26, 2008: Message edited by: Karol Klonowski ]
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Karol Klonowski:

Before that, i tried with streamtokenizer, it compiles and runs but the words chosen by programm are really strange, like: "In and honour you here here peace honour In " and so on, some words are chosen lots of times.


Welcome to the JavaRanch.
What do you expect the program to do?
What does your input look like?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!