// // frequency_monobit.cpp // rng // // Created by Asher Falcon on 21/06/2025. // #include "../rng.h" #include "./rngtest.h" namespace splat { class frequency_monobit_test : public RNGTEST { public: frequency_monobit_test(std::vector> &testData) : RNGTEST(testData) { testPValue = runTest(data); testPassed = testPValue > 0.01; } std::string getName() override { return "Frequency Monobit"; } double runTest(std::vector> &data) override { long long s = 0; for(auto bitset : data){ for(int i=0; i<32; i++){ s += (2*bitset[i])-1; } } double sobs = ((double)std::abs(s))/std::sqrt(data.size()*32); double pvalue = std::erfc(sobs/std::sqrt(2)); return pvalue; } }; }