Commit 8cbc14de authored by Nicholas Ormrod's avatar Nicholas Ormrod Committed by Pavlo Kushnir

Fix global statics

Summary:
Statics in headers are bad.

Test Plan: run unit tests

Reviewed By: robbert@fb.com

Subscribers: trunkagent, sdwilsh, njormrod, folly-diffs@

FB internal diff: D1646906

Tasks: 5486739

Signature: t1:1646906:1415042805:dc4d1cec54e9320f1e609808a73622c731a4cdc9
parent 4de78cbf
...@@ -168,7 +168,7 @@ public: ...@@ -168,7 +168,7 @@ public:
// conversion factory // conversion factory
template <typename T, typename It> template <typename T, typename It>
static inline std::move_iterator<Transformer<T, It>> inline std::move_iterator<Transformer<T, It>>
conversionIterator(const It& it) { conversionIterator(const It& it) {
return std::make_move_iterator(Transformer<T, It>(it)); return std::make_move_iterator(Transformer<T, It>(it));
} }
......
...@@ -30,14 +30,16 @@ ...@@ -30,14 +30,16 @@
#include <folly/Synchronized.h> #include <folly/Synchronized.h>
static const auto seed = folly::randomNumberSeed(); inline std::mt19937& getRNG() {
typedef std::mt19937 RandomT; static const auto seed = folly::randomNumberSeed();
static RandomT rng(seed); static std::mt19937 rng(seed);
return rng;
}
template <class Integral1, class Integral2> template <class Integral1, class Integral2>
Integral2 random(Integral1 low, Integral2 up) { Integral2 random(Integral1 low, Integral2 up) {
std::uniform_int_distribution<> range(low, up); std::uniform_int_distribution<> range(low, up);
return range(rng); return range(getRNG());
} }
template <class Mutex> template <class Mutex>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment