util: use C++11 <random> instead of Boost.Random

Change-Id: Id0100a5ef14236f7e1d1f181af233e44bde3c1a2
Refs: #3599
diff --git a/src/util/random.cpp b/src/util/random.cpp
index a16d587..41775e4 100644
--- a/src/util/random.cpp
+++ b/src/util/random.cpp
@@ -19,20 +19,14 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#include "common.hpp"
-
 #include "random.hpp"
 #include "../security/detail/openssl.hpp"
 
-#include <boost/nondet_random.hpp>
-#include <boost/random/mersenne_twister.hpp>
-#include <boost/random/uniform_int_distribution.hpp>
+#include <random>
 
 namespace ndn {
 namespace random {
 
-// OpenSSL-based (secure) pseudo-randomness generators
-
 uint32_t
 generateSecureWord32()
 {
@@ -58,31 +52,26 @@
   }
 }
 
-// Boost.Random-based (simple) random generators
-
-static boost::random::mt19937&
+static std::mt19937&
 getRandomGenerator()
 {
-  static boost::random_device randomSeedGenerator;
-  static boost::random::mt19937 gen(randomSeedGenerator);
-
-  return gen;
+  static std::mt19937 rng{std::random_device{}()};
+  return rng;
 }
 
 uint32_t
 generateWord32()
 {
-  static boost::random::uniform_int_distribution<uint32_t> distribution;
+  static std::uniform_int_distribution<uint32_t> distribution;
   return distribution(getRandomGenerator());
 }
 
 uint64_t
 generateWord64()
 {
-  static boost::random::uniform_int_distribution<uint64_t> distribution;
+  static std::uniform_int_distribution<uint64_t> distribution;
   return distribution(getRandomGenerator());
 }
 
-
 } // namespace random
 } // namespace ndn
diff --git a/src/util/random.hpp b/src/util/random.hpp
index e47b5fb..68dbe86 100644
--- a/src/util/random.hpp
+++ b/src/util/random.hpp
@@ -52,11 +52,9 @@
 generateSecureBytes(uint8_t* bytes, size_t size);
 
 /**
- * @brief Generate a cryptographically non-secure random integer from the range [0, 2^32)
+ * @brief Generate a non-cryptographically-secure random integer in the range [0, 2^32)
  *
- * This method uses Boost.Random routines
- *
- * This version is faster than generateSecureWord32, but it should not be used when
+ * This version is faster than generateSecureWord32, but it must not be used when
  * cryptographically secure random integers are needed (e.g., when creating signing or
  * encryption keys)
  */
@@ -64,11 +62,9 @@
 generateWord32();
 
 /**
- * @brief Generate a cryptographically non-secure random integer from range [0, 2^64)
+ * @brief Generate a non-cryptographically-secure random integer in the range [0, 2^64)
  *
- * This method uses Boost.Random routines
- *
- * This version is faster than generateSecureWord64, but it should not be used when
+ * This version is faster than generateSecureWord64, but it must not be used when
  * cryptographically secure random integers are needed (e.g., when creating signing or
  * encryption keys)
  */
diff --git a/wscript b/wscript
index 35465b8..5cff2a6 100644
--- a/wscript
+++ b/wscript
@@ -104,8 +104,8 @@
     conf.check_openssl(mandatory=True, atleast_version=0x10001000) # 1.0.1
 
     USED_BOOST_LIBS = ['system', 'filesystem', 'date_time', 'iostreams',
-                       'regex', 'program_options', 'chrono', 'random',
-                       'thread', 'log', 'log_setup']
+                       'regex', 'program_options', 'chrono', 'thread',
+                       'log', 'log_setup']
 
     if conf.env['WITH_TESTS']:
         USED_BOOST_LIBS += ['unit_test_framework']