Skip to content

Commit 3896176

Browse files
committed
Don't use std::random_device
1 parent 21a222f commit 3896176

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

cp-algo/util/big_alloc.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef CP_ALGO_UTIL_big_alloc_HPP
22
#define CP_ALGO_UTIL_big_alloc_HPP
33

4+
#include <map>
45
#include <deque>
56
#include <vector>
67
#include <string>
@@ -69,6 +70,8 @@ namespace cp_algo {
6970
using big_basic_string = std::basic_string<T, std::char_traits<T>, big_alloc<T>>;
7071
template<typename T>
7172
using big_deque = std::deque<T, big_alloc<T>>;
73+
template<typename Key, typename Value, typename Compare = std::less<Key>>
74+
using big_map = std::map<Key, Value, Compare, big_alloc<std::pair<const Key, Value>>>;
7275
using big_string = big_basic_string<char>;
7376
}
7477
#endif // CP_ALGO_UTIL_big_alloc_HPP

cp-algo/util/checkpoint.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <map>
88
namespace cp_algo {
99
#ifdef CP_ALGO_CHECKPOINT
10-
std::map<big_string, double> checkpoints;
10+
big_map<big_string, double> checkpoints;
1111
double last;
1212
#endif
1313
template<bool final = false>

verify/poly/wildcard.test.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@ cp_algo::big_string matches(cp_algo::big_string const& A, cp_algo::big_string co
3232
static bool init = false;
3333
if(!init) {
3434
init = true;
35-
std::random_device rd;
36-
std::mt19937 gen(rd());
3735
std::uniform_real_distribution<> dis(.5, 2.);
3836
for(int i = 0; i < 128; i++) {
39-
ftype x = dis(gen);
37+
ftype x = dis(cp_algo::random::gen);
4038
project[0][i] = x;
4139
project[1][i] = 1. / x;
4240
}

0 commit comments

Comments
 (0)