TEST(Util, NormalSampleTest) { VReal tmp; for (int i = 0; i < 1000000; i++) { tmp.push_back(NormalSample() / 100); } EXPECT_LT(std::abs(0.0 - Mean(tmp)), 0.00001); EXPECT_LT(std::abs(0.0001 - Var(tmp)), 0.00001); VVVReal tmp2; RandomInit(100, 100, 100, &tmp2); EXPECT_LT(std::abs(0.0 - Mean(tmp2)), 0.00001); EXPECT_LT(std::abs(0.0001 - Var(tmp2)), 0.00001); }
NormalSample NormalSample::generate() { return NormalSample( random::gauss(1.0) ); }