randomness_testsuite icon indicating copy to clipboard operation
randomness_testsuite copied to clipboard

[Cumulative Sums Test] Add/Sub -1 after division instead of before leads to wrong result for test.

Open LukasMarckmiller opened this issue 10 months ago • 1 comments

According to the NIST Standard 1 needs to be subtracted/added before the division. Screenshot_2024-04-19_09-37-58

This is not the case for following lines: https://github.com/stevenang/randomness_testsuite/blob/7147879859d095a4cac63962efd7a19d4874a630/CumulativeSum.py#L54-L55

It should be:

start = int(floor(0.25 * floor(-length_of_binary_data / abs_max + 1)))
end = int(floor(0.25 * floor(length_of_binary_data / abs_max - 1)))

This is correct for the second sum though: https://github.com/stevenang/randomness_testsuite/blob/7147879859d095a4cac63962efd7a19d4874a630/CumulativeSum.py#L62-L63

LukasMarckmiller avatar Apr 19 '24 07:04 LukasMarckmiller

Current: 13. Cummulative Sums (Forward) Test (1.0, True) 14. Cummulative Sums (Reverse) Test (1.0, True)

Fixed: 13. Cummulative Sums (Forward) Test (2.2319712527895903e-302, False) 14. Cummulative Sums (Reverse) Test (2.2319712527895903e-302, False)

I can provide the test data (private msg) if needed.

LukasMarckmiller avatar Apr 19 '24 07:04 LukasMarckmiller

Can this issue be closed, given that it was fixed?

alexb5dh avatar Aug 28 '24 20:08 alexb5dh