I am testing my sequence for randomness using Dieharder with a command like dieharder -a -g 202 -f in.txt >>result.txt

my in.txt looks like

# generator mt19937  seed = 316179543
type: d
count: 40000004
numbit: 32
...  // 40M more lines of numbers
//Does Dieharder need this empty line before the end of file?

If 3557717321 is the last number in tested sequence, does Dieharder expect an empty line after it? Shoud the file end with 3557717321 or 3557717321\n?

  • $\begingroup$ @fgrieu can you please make it an answer? I had a new line in my tests nad wasn't sure if it causes a problem.Your answer suggests that Dieharder reads count: $count, and woks with the first $count lines of actual data, ignoring the rest. $\endgroup$ – Stepan Aug 16 '18 at 15:18

Looking at the source, file_input_get in dieharder-3.31.1/libdieharder/rng_file_input.c: you are safe with a single newline after the last decimal number, as supplied by Java's writer.println. You do not need an extra newline. If there was a problem, DieHarder would stop with "# file_input(): Error: EOF on (filename)" or "Error: converting (stuff) failed. Exiting."

But this is kinda off-topic.

| improve this answer | |
  • $\begingroup$ I'm getting this error # file_input(): Error: EOF on (filename). Even if I already had to cut the file off, how can I solve this error? Tks $\endgroup$ – Ender Apr 22 at 10:00
  • 1
    $\begingroup$ @Ender: this error tends to mean that the file does not contain as much data as expected given the header of the file. Like, less than the number of values specified by count. Please refer to the manual that came with the tool, or perhaps this; and of course, the source, wich is the ultimate doc. It will I believe confirm that what's on a line starting with # is ignored, when not in binary mode. But again, refer to doc and source please. $\endgroup$ – fgrieu Apr 22 at 10:15
  • $\begingroup$ Tks, I will test it out. Btw, does the part after # mean anything? Or just a place for information? The parameter generator and seed, do you think it impacts to the process? And the Type: d means for digit and b for binary? $\endgroup$ – Ender Apr 22 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.