For some reason this code results in a truncated text.txt file. It should (according to me) write out 1000 results, but the output file has various amounts of lines (dependi
You forgot to close() the writer, so you never gave it a chance to flush buffered output to disk.