|
|
@ -25,14 +25,21 @@ BOOST_AUTO_TEST_CASE(fastrandom_tests)
|
|
|
|
BOOST_CHECK_EQUAL(ctx1.rand32(), ctx2.rand32());
|
|
|
|
BOOST_CHECK_EQUAL(ctx1.rand32(), ctx2.rand32());
|
|
|
|
BOOST_CHECK_EQUAL(ctx1.rand64(), ctx2.rand64());
|
|
|
|
BOOST_CHECK_EQUAL(ctx1.rand64(), ctx2.rand64());
|
|
|
|
BOOST_CHECK_EQUAL(ctx1.randbits(3), ctx2.randbits(3));
|
|
|
|
BOOST_CHECK_EQUAL(ctx1.randbits(3), ctx2.randbits(3));
|
|
|
|
|
|
|
|
BOOST_CHECK(ctx1.randbytes(17) == ctx2.randbytes(17));
|
|
|
|
|
|
|
|
BOOST_CHECK(ctx1.rand256() == ctx2.rand256());
|
|
|
|
BOOST_CHECK_EQUAL(ctx1.randbits(7), ctx2.randbits(7));
|
|
|
|
BOOST_CHECK_EQUAL(ctx1.randbits(7), ctx2.randbits(7));
|
|
|
|
|
|
|
|
BOOST_CHECK(ctx1.randbytes(128) == ctx2.randbytes(128));
|
|
|
|
BOOST_CHECK_EQUAL(ctx1.rand32(), ctx2.rand32());
|
|
|
|
BOOST_CHECK_EQUAL(ctx1.rand32(), ctx2.rand32());
|
|
|
|
BOOST_CHECK_EQUAL(ctx1.randbits(3), ctx2.randbits(3));
|
|
|
|
BOOST_CHECK_EQUAL(ctx1.randbits(3), ctx2.randbits(3));
|
|
|
|
|
|
|
|
BOOST_CHECK(ctx1.rand256() == ctx2.rand256());
|
|
|
|
|
|
|
|
BOOST_CHECK(ctx1.randbytes(50) == ctx2.randbytes(50));
|
|
|
|
|
|
|
|
|
|
|
|
// Check that a nondeterministic ones are not
|
|
|
|
// Check that a nondeterministic ones are not
|
|
|
|
FastRandomContext ctx3;
|
|
|
|
FastRandomContext ctx3;
|
|
|
|
FastRandomContext ctx4;
|
|
|
|
FastRandomContext ctx4;
|
|
|
|
BOOST_CHECK(ctx3.rand64() != ctx4.rand64()); // extremely unlikely to be equal
|
|
|
|
BOOST_CHECK(ctx3.rand64() != ctx4.rand64()); // extremely unlikely to be equal
|
|
|
|
|
|
|
|
BOOST_CHECK(ctx3.rand256() != ctx4.rand256());
|
|
|
|
|
|
|
|
BOOST_CHECK(ctx3.randbytes(7) != ctx4.randbytes(7));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_CASE(fastrandom_randbits)
|
|
|
|
BOOST_AUTO_TEST_CASE(fastrandom_randbits)
|
|
|
|