From d6470abef1ca76c40e6da3b4445b7c32f1d0e2e3 Mon Sep 17 00:00:00 2001 From: Wayne Zhang Date: Tue, 30 May 2017 11:18:23 -0700 Subject: not to use std::random_device for map.Seed(). (#3133) * not to use std::random_device for map.Seed(). * remove include random --- src/google/protobuf/map.h | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'src/google') diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h index 18ee3652..e5a32c5c 100644 --- a/src/google/protobuf/map.h +++ b/src/google/protobuf/map.h @@ -47,9 +47,6 @@ #include #include #include -#if __cpp_exceptions && LANG_CXX11 -#include -#endif namespace google { namespace protobuf { @@ -922,16 +919,6 @@ class Map { // Return a randomish value. size_type Seed() const { - // random_device can throw, so avoid it unless we are compiling with - // exceptions enabled. -#if __cpp_exceptions && LANG_CXX11 - try { - std::random_device rd; - std::knuth_b knuth(rd()); - std::uniform_int_distribution u; - return u(knuth); - } catch (...) { } -#endif size_type s = static_cast(reinterpret_cast(this)); #if defined(__x86_64__) && defined(__GNUC__) uint32 hi, lo; -- cgit v1.2.3