mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
[tests] Use FastRandomContext instead of boost::random::{mt19937,uniform_int_distribution}
This commit is contained in:
parent
1b708f2cf3
commit
227ae9b34d
@ -8,8 +8,6 @@
|
||||
#include "test/test_bitcoin.h"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/random/mersenne_twister.hpp>
|
||||
#include <boost/random/uniform_int_distribution.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
@ -56,10 +54,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]
|
||||
|
||||
boost::chrono::system_clock::time_point start = boost::chrono::system_clock::now();
|
||||
boost::chrono::system_clock::time_point now = start;
|
||||
|
Loading…
Reference in New Issue
Block a user