@@ -28,6 +28,8 @@ BOOST_AUTO_TEST_CASE(fastrandom_tests)
28
28
for (int i = 10 ; i > 0 ; --i) {
29
29
BOOST_CHECK_EQUAL (GetRand (std::numeric_limits<uint64_t >::max ()), uint64_t {10393729187455219830U });
30
30
BOOST_CHECK_EQUAL (GetRandInt (std::numeric_limits<int >::max ()), int {769702006 });
31
+ BOOST_CHECK_EQUAL (GetRandMicros (std::chrono::hours{1 }).count (), 2917185654 );
32
+ BOOST_CHECK_EQUAL (GetRandMillis (std::chrono::hours{1 }).count (), 2144374 );
31
33
}
32
34
BOOST_CHECK_EQUAL (ctx1.rand32 (), ctx2.rand32 ());
33
35
BOOST_CHECK_EQUAL (ctx1.rand32 (), ctx2.rand32 ());
@@ -47,6 +49,8 @@ BOOST_AUTO_TEST_CASE(fastrandom_tests)
47
49
for (int i = 10 ; i > 0 ; --i) {
48
50
BOOST_CHECK (GetRand (std::numeric_limits<uint64_t >::max ()) != uint64_t {10393729187455219830U });
49
51
BOOST_CHECK (GetRandInt (std::numeric_limits<int >::max ()) != int {769702006 });
52
+ BOOST_CHECK (GetRandMicros (std::chrono::hours{1 }) != std::chrono::microseconds{2917185654 });
53
+ BOOST_CHECK (GetRandMillis (std::chrono::hours{1 }) != std::chrono::milliseconds{2144374 });
50
54
}
51
55
{
52
56
FastRandomContext ctx3, ctx4;
@@ -87,7 +91,7 @@ BOOST_AUTO_TEST_CASE(stdrandom_test)
87
91
BOOST_CHECK (x >= 3 );
88
92
BOOST_CHECK (x <= 9 );
89
93
90
- std::vector<int > test{1 ,2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 };
94
+ std::vector<int > test{1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 };
91
95
std::shuffle (test.begin (), test.end (), ctx);
92
96
for (int j = 1 ; j <= 10 ; ++j) {
93
97
BOOST_CHECK (std::find (test.begin (), test.end (), j) != test.end ());
@@ -97,7 +101,6 @@ BOOST_AUTO_TEST_CASE(stdrandom_test)
97
101
BOOST_CHECK (std::find (test.begin (), test.end (), j) != test.end ());
98
102
}
99
103
}
100
-
101
104
}
102
105
103
106
/* * Test that Shuffle reaches every permutation with equal probability. */
0 commit comments