Skip to content

Commit

Permalink
[tests] Use FastRandomContext in scheduler_tests.cpp
Browse files Browse the repository at this point in the history
instead of boost::random::{mt19937,uniform_int_distribution}
  • Loading branch information
practicalswift authored and Fuzzbawls committed Feb 7, 2022
1 parent eca7277 commit 0e66a7d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/test/scheduler_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#include "config/pivx-config.h"
#endif

#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_int_distribution.hpp>
#include <boost/thread.hpp>
#include <boost/test/unit_test.hpp>

Expand Down Expand Up @@ -46,10 +44,10 @@ BOOST_AUTO_TEST_CASE(manythreads)

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

std::chrono::system_clock::time_point start = std::chrono::system_clock::now();
std::chrono::system_clock::time_point now = start;
Expand Down

0 comments on commit 0e66a7d

Please sign in to comment.