From 1962ee07f5e08781ee58f5fcf319ecae419e4c0e Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Fri, 1 Jul 2016 20:39:26 -0700 Subject: [PATCH] Use a defined form of uniform_int_distribution Summary: As per http://en.cppreference.com/w/cpp/numeric/random/uniform_int_distribution the behavior of using `uint8_t` as the template parameter is undefined, and is not supported on MSVC, so use `unsigned short` instead, which is a defined form. Reviewed By: yfeldblum Differential Revision: D3507309 fbshipit-source-id: c4c830371d08aee4a3de90bb394d22d92ad9a575 --- folly/test/FingerprintBenchmark.cpp | 2 +- folly/test/HashBenchmark.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/folly/test/FingerprintBenchmark.cpp b/folly/test/FingerprintBenchmark.cpp index c0135a09..a38b8e31 100644 --- a/folly/test/FingerprintBenchmark.cpp +++ b/folly/test/FingerprintBenchmark.cpp @@ -43,7 +43,7 @@ void initialize() { // word length = uniformly distributed between 1 and 10 // charset = 0x20 - 0x7f std::uniform_int_distribution term_len(1, 10); - std::uniform_int_distribution term_char(0x20, 0x7f); + std::uniform_int_distribution term_char(0x20, 0x7f); for (int i = 0; i < kMaxTerms; i++) { std::string& term = terms[i]; int len = term_len(rng); diff --git a/folly/test/HashBenchmark.cpp b/folly/test/HashBenchmark.cpp index eaf06e78..f62223ef 100644 --- a/folly/test/HashBenchmark.cpp +++ b/folly/test/HashBenchmark.cpp @@ -34,7 +34,7 @@ namespace detail { std::vector randomBytes(size_t n) { std::vector ret(n); std::default_random_engine rng(1729); // Deterministic seed. - std::uniform_int_distribution dist(0, 255); + std::uniform_int_distribution dist(0, 255); std::generate(ret.begin(), ret.end(), [&] () { return dist(rng); }); return ret; } -- 2.34.1