Skip to content

Commit faba3f6

Browse files
practicalswiftFuzzbawls
authored andcommitted
[tests] Use FastRandomContext in scheduler_tests.cpp
instead of boost::random::{mt19937,uniform_int_distribution}
1 parent 2034bf6 commit faba3f6

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/test/scheduler_tests.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
#include "config/pivx-config.h"
1111
#endif
1212

13-
#include <boost/random/mersenne_twister.hpp>
14-
#include <boost/random/uniform_int_distribution.hpp>
1513
#include <boost/thread.hpp>
1614
#include <boost/test/unit_test.hpp>
1715

@@ -46,10 +44,10 @@ BOOST_AUTO_TEST_CASE(manythreads)
4644

4745
boost::mutex counterMutex[10];
4846
int counter[10] = { 0 };
49-
boost::random::mt19937 rng(42);
50-
boost::random::uniform_int_distribution<> zeroToNine(0, 9);
51-
boost::random::uniform_int_distribution<> randomMsec(-11, 1000);
52-
boost::random::uniform_int_distribution<> randomDelta(-1000, 1000);
47+
FastRandomContext rng(42);
48+
auto zeroToNine = [](FastRandomContext& rc) -> int { return rc.randrange(10); }; // [0, 9]
49+
auto randomMsec = [](FastRandomContext& rc) -> int { return -11 + rc.randrange(1012); }; // [-11, 1000]
50+
auto randomDelta = [](FastRandomContext& rc) -> int { return -1000 + rc.randrange(2001); }; // [-1000, 1000]
5351

5452
std::chrono::system_clock::time_point start = std::chrono::system_clock::now();
5553
std::chrono::system_clock::time_point now = start;

0 commit comments

Comments
 (0)