diff --git a/include/ndnboost/random/detail/config.hpp b/include/ndnboost/random/detail/config.hpp
new file mode 100644
index 0000000..0d7f7bb
--- /dev/null
+++ b/include/ndnboost/random/detail/config.hpp
@@ -0,0 +1,18 @@
+/* boost random/detail/config.hpp header file
+ *
+ * Copyright Steven Watanabe 2009
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org for most recent version including documentation.
+ *
+ * $Id: config.hpp 52492 2009-04-19 14:55:57Z steven_watanabe $
+ */
+
+#include <ndnboost/config.hpp>
+
+#if (defined(NDNBOOST_NO_OPERATORS_IN_NAMESPACE) || defined(NDNBOOST_NO_MEMBER_TEMPLATE_FRIENDS)) \
+    && !defined(NDNBOOST_MSVC)
+    #define NDNBOOST_RANDOM_NO_STREAM_OPERATORS
+#endif
diff --git a/include/ndnboost/random/detail/const_mod.hpp b/include/ndnboost/random/detail/const_mod.hpp
new file mode 100644
index 0000000..20277f2
--- /dev/null
+++ b/include/ndnboost/random/detail/const_mod.hpp
@@ -0,0 +1,216 @@
+/* boost random/detail/const_mod.hpp header file
+ *
+ * Copyright Jens Maurer 2000-2001
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org for most recent version including documentation.
+ *
+ * $Id: const_mod.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $
+ *
+ * Revision history
+ *  2001-02-18  moved to individual header files
+ */
+
+#ifndef NDNBOOST_RANDOM_CONST_MOD_HPP
+#define NDNBOOST_RANDOM_CONST_MOD_HPP
+
+#include <ndnboost/assert.hpp>
+#include <ndnboost/static_assert.hpp>
+#include <ndnboost/integer_traits.hpp>
+#include <ndnboost/type_traits/make_unsigned.hpp>
+#include <ndnboost/random/detail/large_arithmetic.hpp>
+
+#include <ndnboost/random/detail/disable_warnings.hpp>
+
+namespace ndnboost {
+namespace random {
+
+template<class IntType, IntType m>
+class const_mod
+{
+public:
+  static IntType apply(IntType x)
+  {
+    if(((unsigned_m() - 1) & unsigned_m()) == 0)
+      return (unsigned_type(x)) & (unsigned_m() - 1);
+    else {
+      IntType supress_warnings = (m == 0);
+      NDNBOOST_ASSERT(supress_warnings == 0);
+      return x % (m + supress_warnings);
+    }
+  }
+
+  static IntType add(IntType x, IntType c)
+  {
+    if(((unsigned_m() - 1) & unsigned_m()) == 0)
+      return (unsigned_type(x) + unsigned_type(c)) & (unsigned_m() - 1);
+    else if(c == 0)
+      return x;
+    else if(x < m - c)
+      return x + c;
+    else
+      return x - (m - c);
+  }
+
+  static IntType mult(IntType a, IntType x)
+  {
+    if(((unsigned_m() - 1) & unsigned_m()) == 0)
+      return unsigned_type(a) * unsigned_type(x) & (unsigned_m() - 1);
+    else if(a == 0)
+      return 0;
+    else if(a == 1)
+      return x;
+    else if(m <= traits::const_max/a)      // i.e. a*m <= max
+      return mult_small(a, x);
+    else if(traits::is_signed && (m%a < m/a))
+      return mult_schrage(a, x);
+    else
+      return mult_general(a, x);
+  }
+
+  static IntType mult_add(IntType a, IntType x, IntType c)
+  {
+    if(((unsigned_m() - 1) & unsigned_m()) == 0)
+      return (unsigned_type(a) * unsigned_type(x) + unsigned_type(c)) & (unsigned_m() - 1);
+    else if(a == 0)
+      return c;
+    else if(m <= (traits::const_max-c)/a) {  // i.e. a*m+c <= max
+      IntType supress_warnings = (m == 0);
+      NDNBOOST_ASSERT(supress_warnings == 0);
+      return (a*x+c) % (m + supress_warnings);
+    } else
+      return add(mult(a, x), c);
+  }
+
+  static IntType pow(IntType a, ndnboost::uintmax_t exponent)
+  {
+      IntType result = 1;
+      while(exponent != 0) {
+          if(exponent % 2 == 1) {
+              result = mult(result, a);
+          }
+          a = mult(a, a);
+          exponent /= 2;
+      }
+      return result;
+  }
+
+  static IntType invert(IntType x)
+  { return x == 0 ? 0 : (m == 0? invert_euclidian0(x) : invert_euclidian(x)); }
+
+private:
+  typedef integer_traits<IntType> traits;
+  typedef typename make_unsigned<IntType>::type unsigned_type;
+
+  const_mod();      // don't instantiate
+
+  static IntType mult_small(IntType a, IntType x)
+  {
+    IntType supress_warnings = (m == 0);
+    NDNBOOST_ASSERT(supress_warnings == 0);
+    return a*x % (m + supress_warnings);
+  }
+
+  static IntType mult_schrage(IntType a, IntType value)
+  {
+    const IntType q = m / a;
+    const IntType r = m % a;
+
+    NDNBOOST_ASSERT(r < q);        // check that overflow cannot happen
+
+    return sub(a*(value%q), r*(value/q));
+  }
+
+  static IntType mult_general(IntType a, IntType b)
+  {
+    IntType suppress_warnings = (m == 0);
+    NDNBOOST_ASSERT(suppress_warnings == 0);
+    IntType modulus = m + suppress_warnings;
+    NDNBOOST_ASSERT(modulus == m);
+    if(::ndnboost::uintmax_t(modulus) <=
+        (::std::numeric_limits< ::ndnboost::uintmax_t>::max)() / modulus)
+    {
+      return static_cast<IntType>(ndnboost::uintmax_t(a) * b % modulus);
+    } else {
+      return static_cast<IntType>(detail::mulmod(a, b, modulus));
+    }
+  }
+
+  static IntType sub(IntType a, IntType b)
+  {
+    if(a < b)
+      return m - (b - a);
+    else
+      return a - b;
+  }
+
+  static unsigned_type unsigned_m()
+  {
+      if(m == 0) {
+          return unsigned_type((std::numeric_limits<IntType>::max)()) + 1;
+      } else {
+          return unsigned_type(m);
+      }
+  }
+
+  // invert c in the finite field (mod m) (m must be prime)
+  static IntType invert_euclidian(IntType c)
+  {
+    // we are interested in the gcd factor for c, because this is our inverse
+    NDNBOOST_ASSERT(c > 0);
+    IntType l1 = 0;
+    IntType l2 = 1;
+    IntType n = c;
+    IntType p = m;
+    for(;;) {
+      IntType q = p / n;
+      l1 += q * l2;
+      p -= q * n;
+      if(p == 0)
+        return l2;
+      IntType q2 = n / p;
+      l2 += q2 * l1;
+      n -= q2 * p;
+      if(n == 0)
+        return m - l1;
+    }
+  }
+
+  // invert c in the finite field (mod m) (c must be relatively prime to m)
+  static IntType invert_euclidian0(IntType c)
+  {
+    // we are interested in the gcd factor for c, because this is our inverse
+    NDNBOOST_ASSERT(c > 0);
+    if(c == 1) return 1;
+    IntType l1 = 0;
+    IntType l2 = 1;
+    IntType n = c;
+    IntType p = m;
+    IntType max = (std::numeric_limits<IntType>::max)();
+    IntType q = max / n;
+    NDNBOOST_ASSERT(max % n != n - 1 && "c must be relatively prime to m.");
+    l1 += q * l2;
+    p = max - q * n + 1;
+    for(;;) {
+      if(p == 0)
+        return l2;
+      IntType q2 = n / p;
+      l2 += q2 * l1;
+      n -= q2 * p;
+      if(n == 0)
+        return m - l1;
+      q = p / n;
+      l1 += q * l2;
+      p -= q * n;
+    }
+  }
+};
+
+} // namespace random
+} // namespace ndnboost
+
+#include <ndnboost/random/detail/enable_warnings.hpp>
+
+#endif // NDNBOOST_RANDOM_CONST_MOD_HPP
diff --git a/include/ndnboost/random/detail/disable_warnings.hpp b/include/ndnboost/random/detail/disable_warnings.hpp
new file mode 100644
index 0000000..4f707d0
--- /dev/null
+++ b/include/ndnboost/random/detail/disable_warnings.hpp
@@ -0,0 +1,23 @@
+/* boost random/detail/disable_warnings.hpp header file
+ *
+ * Copyright Steven Watanabe 2009
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org for most recent version including documentation.
+ *
+ * $Id: disable_warnings.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ */
+
+// No #include guard.  This header is intended to be included multiple times.
+
+#include <ndnboost/config.hpp>
+
+#ifdef NDNBOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4512)
+#pragma warning(disable:4127)
+#pragma warning(disable:4724)
+#endif
diff --git a/include/ndnboost/random/detail/enable_warnings.hpp b/include/ndnboost/random/detail/enable_warnings.hpp
new file mode 100644
index 0000000..68535e2
--- /dev/null
+++ b/include/ndnboost/random/detail/enable_warnings.hpp
@@ -0,0 +1,18 @@
+/* boost random/detail/enable_warnings.hpp header file
+ *
+ * Copyright Steven Watanabe 2009
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org for most recent version including documentation.
+ *
+ * $Id: enable_warnings.hpp 58649 2010-01-02 21:23:17Z steven_watanabe $
+ *
+ */
+
+// No #include guard.  This header is intended to be included multiple times.
+
+#ifdef NDNBOOST_MSVC
+#pragma warning(pop)
+#endif
diff --git a/include/ndnboost/random/detail/generator_bits.hpp b/include/ndnboost/random/detail/generator_bits.hpp
new file mode 100644
index 0000000..94d49d6
--- /dev/null
+++ b/include/ndnboost/random/detail/generator_bits.hpp
@@ -0,0 +1,36 @@
+/* boost random/detail/generator_bits.hpp header file
+ *
+ * Copyright Steven Watanabe 2011
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org for most recent version including documentation.
+ *
+ * $Id: generator_bits.hpp 72951 2011-07-07 04:57:37Z steven_watanabe $
+ *
+ */
+
+#ifndef NDNBOOST_RANDOM_DETAIL_GENERATOR_BITS_HPP
+#define NDNBOOST_RANDOM_DETAIL_GENERATOR_BITS_HPP
+
+#include <ndnboost/limits.hpp>
+
+namespace ndnboost {
+namespace random {
+namespace detail {
+
+// This is a temporary measure that retains backwards
+// compatibility.
+template<class URNG>
+struct generator_bits {
+    static std::size_t value() {
+        return std::numeric_limits<typename URNG::result_type>::digits;
+    }
+};
+
+} // namespace detail
+} // namespace random
+} // namespace ndnboost
+
+#endif // NDNBOOST_RANDOM_DETAIL_GENERATOR_BITS_HPP
diff --git a/include/ndnboost/random/detail/integer_log2.hpp b/include/ndnboost/random/detail/integer_log2.hpp
new file mode 100644
index 0000000..f7429af
--- /dev/null
+++ b/include/ndnboost/random/detail/integer_log2.hpp
@@ -0,0 +1,84 @@
+/* boost random/detail/integer_log2.hpp header file
+ *
+ * Copyright Steven Watanabe 2011
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org for most recent version including documentation.
+ *
+ * $Id: integer_log2.hpp 83381 2013-03-09 22:55:05Z eric_niebler $
+ *
+ */
+
+#ifndef NDNBOOST_RANDOM_DETAIL_INTEGER_LOG2_HPP
+#define NDNBOOST_RANDOM_DETAIL_INTEGER_LOG2_HPP
+
+#include <ndnboost/config.hpp>
+#include <ndnboost/limits.hpp>
+#include <ndnboost/pending/integer_log2.hpp>
+
+namespace ndnboost {
+namespace random {
+namespace detail {
+
+#if !defined(NDNBOOST_NO_CXX11_CONSTEXPR)
+#define NDNBOOST_RANDOM_DETAIL_CONSTEXPR constexpr
+#elif defined(NDNBOOST_MSVC)
+#define NDNBOOST_RANDOM_DETAIL_CONSTEXPR __forceinline
+#elif defined(__GNUC__) && __GNUC__ >= 4
+#define NDNBOOST_RANDOM_DETAIL_CONSTEXPR inline __attribute__((const)) __attribute__((always_inline))
+#else
+#define NDNBOOST_RANDOM_DETAIL_CONSTEXPR inline
+#endif
+
+template<int Shift>
+struct integer_log2_impl
+{
+#if defined(NDNBOOST_NO_CXX11_CONSTEXPR)
+    template<class T>
+    NDNBOOST_RANDOM_DETAIL_CONSTEXPR static int apply(T t, int accum)
+    {
+        int update = ((t >> Shift) != 0) * Shift;
+        return integer_log2_impl<Shift / 2>::apply(t >> update, accum + update);
+    }
+#else
+    template<class T>
+    NDNBOOST_RANDOM_DETAIL_CONSTEXPR static int apply2(T t, int accum, int update)
+    {
+        return integer_log2_impl<Shift / 2>::apply(t >> update, accum + update);
+    }
+
+    template<class T>
+    NDNBOOST_RANDOM_DETAIL_CONSTEXPR static int apply(T t, int accum)
+    {
+        return apply2(t, accum, ((t >> Shift) != 0) * Shift);
+    }
+#endif
+};
+
+template<>
+struct integer_log2_impl<1>
+{
+    template<class T>
+    NDNBOOST_RANDOM_DETAIL_CONSTEXPR static int apply(T t, int accum)
+    {
+        return int(t >> 1) + accum;
+    }
+};
+
+template<class T>
+NDNBOOST_RANDOM_DETAIL_CONSTEXPR int integer_log2(T t)
+{
+    return integer_log2_impl<
+        ::ndnboost::detail::max_pow2_less<
+            ::std::numeric_limits<T>::digits, 4
+        >::value
+    >::apply(t, 0);
+}
+
+} // namespace detail
+} // namespace random
+} // namespace ndnboost
+
+#endif // NDNBOOST_RANDOM_DETAIL_INTEGER_LOG2_HPP
diff --git a/include/ndnboost/random/detail/large_arithmetic.hpp b/include/ndnboost/random/detail/large_arithmetic.hpp
new file mode 100644
index 0000000..c9c6434
--- /dev/null
+++ b/include/ndnboost/random/detail/large_arithmetic.hpp
@@ -0,0 +1,122 @@
+/* boost random/detail/large_arithmetic.hpp header file
+ *
+ * Copyright Steven Watanabe 2011
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org for most recent version including documentation.
+ *
+ * $Id: large_arithmetic.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $
+ */
+
+#ifndef NDNBOOST_RANDOM_DETAIL_LARGE_ARITHMETIC_HPP
+#define NDNBOOST_RANDOM_DETAIL_LARGE_ARITHMETIC_HPP
+
+#include <ndnboost/cstdint.hpp>
+#include <ndnboost/integer.hpp>
+#include <ndnboost/limits.hpp>
+#include <ndnboost/random/detail/integer_log2.hpp>
+
+#include <ndnboost/random/detail/disable_warnings.hpp>
+
+namespace ndnboost {
+namespace random {
+namespace detail {
+
+struct div_t {
+    ndnboost::uintmax_t quotient;
+    ndnboost::uintmax_t remainder;
+};
+
+inline div_t muldivmod(ndnboost::uintmax_t a, ndnboost::uintmax_t b, ndnboost::uintmax_t m)
+{
+    static const int bits =
+        ::std::numeric_limits< ::ndnboost::uintmax_t>::digits / 2;
+    static const ::ndnboost::uintmax_t mask = (::ndnboost::uintmax_t(1) << bits) - 1;
+    typedef ::ndnboost::uint_t<bits>::fast digit_t;
+
+    int shift = std::numeric_limits< ::ndnboost::uintmax_t>::digits - 1
+        - detail::integer_log2(m);
+
+    a <<= shift;
+    m <<= shift;
+
+    digit_t product[4] = { 0, 0, 0, 0 };
+    digit_t a_[2] = { digit_t(a & mask), digit_t((a >> bits) & mask) };
+    digit_t b_[2] = { digit_t(b & mask), digit_t((b >> bits) & mask) };
+    digit_t m_[2] = { digit_t(m & mask), digit_t((m >> bits) & mask) };
+
+    // multiply a * b
+    for(int i = 0; i < 2; ++i) {
+        digit_t carry = 0;
+        for(int j = 0; j < 2; ++j) {
+            ::ndnboost::uint64_t temp = ::ndnboost::uintmax_t(a_[i]) * b_[j] +
+                carry + product[i + j];
+            product[i + j] = digit_t(temp & mask);
+            carry = digit_t(temp >> bits);
+        }
+        if(carry != 0) {
+            product[i + 2] += carry;
+        }
+    }
+
+    digit_t quotient[2];
+
+    if(m == 0) {
+        div_t result = {
+            ((::ndnboost::uintmax_t(product[3]) << bits) | product[2]),
+            ((::ndnboost::uintmax_t(product[1]) << bits) | product[0]) >> shift,
+        };
+        return result;
+    }
+
+    // divide product / m
+    for(int i = 3; i >= 2; --i) {
+        ::ndnboost::uintmax_t temp =
+            ::ndnboost::uintmax_t(product[i]) << bits | product[i - 1];
+
+        digit_t q = digit_t((product[i] == m_[1]) ? mask : temp / m_[1]);
+
+        ::ndnboost::uintmax_t rem =
+            ((temp - ::ndnboost::uintmax_t(q) * m_[1]) << bits) + product[i - 2];
+
+        ::ndnboost::uintmax_t diff = m_[0] * ::ndnboost::uintmax_t(q);
+
+        int error = 0;
+        if(diff > rem) {
+            if(diff - rem > m) {
+                error = 2;
+            } else {
+                error = 1;
+            }
+        }
+        q -= error;
+        rem = rem + error * m - diff;
+
+        quotient[i - 2] = q;
+        product[i] = 0;
+        product[i-1] = (rem >> bits) & mask;
+        product[i-2] = rem & mask;
+    }
+
+    div_t result = {
+        ((::ndnboost::uintmax_t(quotient[1]) << bits) | quotient[0]),
+        ((::ndnboost::uintmax_t(product[1]) << bits) | product[0]) >> shift,
+    };
+    return result;
+}
+
+inline ndnboost::uintmax_t muldiv(ndnboost::uintmax_t a, ndnboost::uintmax_t b, ndnboost::uintmax_t m)
+{ return detail::muldivmod(a, b, m).quotient; }
+
+inline ndnboost::uintmax_t mulmod(ndnboost::uintmax_t a, ndnboost::uintmax_t b, ndnboost::uintmax_t m)
+{ return detail::muldivmod(a, b, m).remainder; }
+
+} // namespace detail
+} // namespace random
+} // namespace ndnboost
+
+#include <ndnboost/random/detail/enable_warnings.hpp>
+
+#endif // NDNBOOST_RANDOM_DETAIL_LARGE_ARITHMETIC_HPP
diff --git a/include/ndnboost/random/detail/operators.hpp b/include/ndnboost/random/detail/operators.hpp
new file mode 100644
index 0000000..4df4881
--- /dev/null
+++ b/include/ndnboost/random/detail/operators.hpp
@@ -0,0 +1,84 @@
+/* boost random/detail/operators.hpp header file
+ *
+ * Copyright Steven Watanabe 2010-2011
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org for most recent version including documentation.
+ *
+ * $Id: operators.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $
+ */
+
+#ifndef NDNBOOST_RANDOM_DETAIL_OPERATORS_HPP
+#define NDNBOOST_RANDOM_DETAIL_OPERATORS_HPP
+
+#include <ndnboost/random/detail/config.hpp>
+#include <ndnboost/detail/workaround.hpp>
+
+#if NDNBOOST_WORKAROUND(NDNBOOST_MSVC, <= 1310)   \
+    || NDNBOOST_WORKAROUND(__SUNPRO_CC, NDNBOOST_TESTED_AT(0x5100))
+
+#define NDNBOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, T, t)                  \
+    template<class CharT, class Traits>                                 \
+    friend std::basic_ostream<CharT,Traits>&                            \
+    operator<<(std::basic_ostream<CharT,Traits>& os, const T& t) {      \
+        t.print(os, t);                                                 \
+        return os;                                                      \
+    }                                                                   \
+    template<class CharT, class Traits>                                 \
+    static std::basic_ostream<CharT,Traits>&                            \
+    print(std::basic_ostream<CharT,Traits>& os, const T& t)
+
+#define NDNBOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, T, t)                  \
+    template<class CharT, class Traits>                                 \
+    friend std::basic_istream<CharT,Traits>&                            \
+    operator>>(std::basic_istream<CharT,Traits>& is, T& t) {            \
+        t.read(is, t);                                                  \
+        return is;                                                      \
+    }                                                                   \
+    template<class CharT, class Traits>                                 \
+    static std::basic_istream<CharT,Traits>&                            \
+    read(std::basic_istream<CharT,Traits>& is, T& t)
+
+#endif
+
+#if defined(__BORLANDC__)
+
+#define NDNBOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(T, lhs, rhs)              \
+    bool operator==(const T& rhs) const                                 \
+    { return T::is_equal(*this, rhs); }                                 \
+    static bool is_equal(const T& lhs, const T& rhs)
+
+#define NDNBOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(T)                      \
+    bool operator!=(const T& rhs) const                                 \
+    { return !T::is_equal(*this, rhs); }
+
+#endif
+
+#ifndef NDNBOOST_RANDOM_DETAIL_OSTREAM_OPERATOR
+#define NDNBOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, T, t)                  \
+    template<class CharT, class Traits>                                 \
+    friend std::basic_ostream<CharT,Traits>&                            \
+    operator<<(std::basic_ostream<CharT,Traits>& os, const T& t)
+#endif
+
+#ifndef NDNBOOST_RANDOM_DETAIL_ISTREAM_OPERATOR
+#define NDNBOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, T, t)                  \
+    template<class CharT, class Traits>                                 \
+    friend std::basic_istream<CharT,Traits>&                            \
+    operator>>(std::basic_istream<CharT,Traits>& is, T& t)
+#endif
+
+#ifndef NDNBOOST_RANDOM_DETAIL_EQUALITY_OPERATOR
+#define NDNBOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(T, lhs, rhs)              \
+    friend bool operator==(const T& lhs, const T& rhs)
+#endif
+
+#ifndef NDNBOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR
+#define NDNBOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(T)                      \
+    friend bool operator!=(const T& lhs, const T& rhs)                  \
+    { return !(lhs == rhs); }
+#endif
+
+#endif
diff --git a/include/ndnboost/random/detail/ptr_helper.hpp b/include/ndnboost/random/detail/ptr_helper.hpp
new file mode 100644
index 0000000..c07a88a
--- /dev/null
+++ b/include/ndnboost/random/detail/ptr_helper.hpp
@@ -0,0 +1,94 @@
+/* boost random/detail/ptr_helper.hpp header file
+ *
+ * Copyright Jens Maurer 2002
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org for most recent version including documentation.
+ *
+ * $Id: ptr_helper.hpp 24096 2004-07-27 03:43:34Z dgregor $
+ *
+ */
+
+#ifndef NDNBOOST_RANDOM_DETAIL_PTR_HELPER_HPP
+#define NDNBOOST_RANDOM_DETAIL_PTR_HELPER_HPP
+
+#include <ndnboost/config.hpp>
+
+
+namespace ndnboost {
+namespace random {
+namespace detail {
+
+// type_traits could help here, but I don't want to depend on type_traits.
+template<class T>
+struct ptr_helper
+{
+  typedef T value_type;
+  typedef T& reference_type;
+  typedef const T& rvalue_type;
+  static reference_type ref(T& r) { return r; }
+  static const T& ref(const T& r) { return r; }
+};
+
+#ifndef NDNBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+template<class T>
+struct ptr_helper<T&>
+{
+  typedef T value_type;
+  typedef T& reference_type;
+  typedef T& rvalue_type;
+  static reference_type ref(T& r) { return r; }
+  static const T& ref(const T& r) { return r; }
+};
+
+template<class T>
+struct ptr_helper<T*>
+{
+  typedef T value_type;
+  typedef T& reference_type;
+  typedef T* rvalue_type;
+  static reference_type ref(T * p) { return *p; }
+  static const T& ref(const T * p) { return *p; }
+};
+#endif
+
+} // namespace detail
+} // namespace random
+} // namespace ndnboost
+
+//
+// NDNBOOST_RANDOM_PTR_HELPER_SPEC --
+//
+//  Helper macro for broken compilers defines specializations of
+//  ptr_helper.
+//
+#ifdef NDNBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+# define NDNBOOST_RANDOM_PTR_HELPER_SPEC(T)                \
+namespace ndnboost { namespace random { namespace detail { \
+template<>                                              \
+struct ptr_helper<T&>                                   \
+{                                                       \
+  typedef T value_type;                                 \
+  typedef T& reference_type;                            \
+  typedef T& rvalue_type;                               \
+  static reference_type ref(T& r) { return r; }         \
+  static const T& ref(const T& r) { return r; }         \
+};                                                      \
+                                                        \
+template<>                                              \
+struct ptr_helper<T*>                                   \
+{                                                       \
+  typedef T value_type;                                 \
+  typedef T& reference_type;                            \
+  typedef T* rvalue_type;                               \
+  static reference_type ref(T * p) { return *p; }       \
+  static const T& ref(const T * p) { return *p; }       \
+};                                                      \
+}}}
+#else
+# define NDNBOOST_RANDOM_PTR_HELPER_SPEC(T)
+#endif 
+
+#endif // NDNBOOST_RANDOM_DETAIL_PTR_HELPER_HPP
diff --git a/include/ndnboost/random/detail/seed.hpp b/include/ndnboost/random/detail/seed.hpp
new file mode 100644
index 0000000..7f5ac2b
--- /dev/null
+++ b/include/ndnboost/random/detail/seed.hpp
@@ -0,0 +1,114 @@
+/* boost random/detail/seed.hpp header file
+ *
+ * Copyright Steven Watanabe 2009
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org for most recent version including documentation.
+ *
+ * $Id: seed.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $
+ */
+
+#ifndef NDNBOOST_RANDOM_DETAIL_SEED_HPP
+#define NDNBOOST_RANDOM_DETAIL_SEED_HPP
+
+#include <ndnboost/config.hpp>
+
+// Sun seems to have trouble with the use of SFINAE for the
+// templated constructor.  So does Borland.
+#if !defined(NDNBOOST_NO_SFINAE) && !defined(__SUNPRO_CC) && !defined(__BORLANDC__)
+
+#include <ndnboost/utility/enable_if.hpp>
+#include <ndnboost/type_traits/is_arithmetic.hpp>
+
+namespace ndnboost {
+namespace random {
+namespace detail {
+
+template<class T>
+struct disable_seed : ndnboost::disable_if<ndnboost::is_arithmetic<T> > {};
+
+template<class Engine, class T>
+struct disable_constructor : disable_seed<T> {};
+
+template<class Engine>
+struct disable_constructor<Engine, Engine> {};
+
+#define NDNBOOST_RANDOM_DETAIL_GENERATOR_CONSTRUCTOR(Self, Generator, gen) \
+    template<class Generator>                                           \
+    explicit Self(Generator& gen, typename ::ndnboost::random::detail::disable_constructor<Self, Generator>::type* = 0)
+
+#define NDNBOOST_RANDOM_DETAIL_GENERATOR_SEED(Self, Generator, gen)    \
+    template<class Generator>                                       \
+    void seed(Generator& gen, typename ::ndnboost::random::detail::disable_seed<Generator>::type* = 0)
+
+#define NDNBOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR(Self, SeedSeq, seq)    \
+    template<class SeedSeq>                                             \
+    explicit Self(SeedSeq& seq, typename ::ndnboost::random::detail::disable_constructor<Self, SeedSeq>::type* = 0)
+
+#define NDNBOOST_RANDOM_DETAIL_SEED_SEQ_SEED(Self, SeedSeq, seq)   \
+    template<class SeedSeq>                                     \
+    void seed(SeedSeq& seq, typename ::ndnboost::random::detail::disable_seed<SeedSeq>::type* = 0)
+
+#define NDNBOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(Self, T, x)  \
+    explicit Self(const T& x)
+
+#define NDNBOOST_RANDOM_DETAIL_ARITHMETIC_SEED(Self, T, x) \
+    void seed(const T& x)
+}
+}
+}
+
+#else
+
+#include <ndnboost/type_traits/is_arithmetic.hpp>
+#include <ndnboost/mpl/bool.hpp>
+
+#define NDNBOOST_RANDOM_DETAIL_GENERATOR_CONSTRUCTOR(Self, Generator, gen) \
+    Self(Self& other) { *this = other; }                                \
+    Self(const Self& other) { *this = other; }                          \
+    template<class Generator>                                           \
+    explicit Self(Generator& gen) {                                     \
+        boost_random_constructor_impl(gen, ::ndnboost::is_arithmetic<Generator>());\
+    }                                                                   \
+    template<class Generator>                                           \
+    void boost_random_constructor_impl(Generator& gen, ::ndnboost::mpl::false_)
+
+#define NDNBOOST_RANDOM_DETAIL_GENERATOR_SEED(Self, Generator, gen)    \
+    template<class Generator>                                       \
+    void seed(Generator& gen) {                                     \
+        boost_random_seed_impl(gen, ::ndnboost::is_arithmetic<Generator>());\
+    }\
+    template<class Generator>\
+    void boost_random_seed_impl(Generator& gen, ::ndnboost::mpl::false_)
+
+#define NDNBOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR(Self, SeedSeq, seq)    \
+    Self(Self& other) { *this = other; }                                \
+    Self(const Self& other) { *this = other; }                          \
+    template<class SeedSeq>                                             \
+    explicit Self(SeedSeq& seq) {                                       \
+        boost_random_constructor_impl(seq, ::ndnboost::is_arithmetic<SeedSeq>());\
+    }                                                                   \
+    template<class SeedSeq>                                             \
+    void boost_random_constructor_impl(SeedSeq& seq, ::ndnboost::mpl::false_)
+
+#define NDNBOOST_RANDOM_DETAIL_SEED_SEQ_SEED(Self, SeedSeq, seq)           \
+    template<class SeedSeq>                                             \
+    void seed(SeedSeq& seq) {                                           \
+        boost_random_seed_impl(seq, ::ndnboost::is_arithmetic<SeedSeq>()); \
+    }                                                                   \
+    template<class SeedSeq>                                             \
+    void boost_random_seed_impl(SeedSeq& seq, ::ndnboost::mpl::false_)
+
+#define NDNBOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(Self, T, x)  \
+    explicit Self(const T& x) { boost_random_constructor_impl(x, ::ndnboost::mpl::true_()); }\
+    void boost_random_constructor_impl(const T& x, ::ndnboost::mpl::true_)
+
+#define NDNBOOST_RANDOM_DETAIL_ARITHMETIC_SEED(Self, T, x) \
+    void seed(const T& x) { boost_random_seed_impl(x, ::ndnboost::mpl::true_()); }\
+    void boost_random_seed_impl(const T& x, ::ndnboost::mpl::true_)
+
+#endif
+
+#endif
diff --git a/include/ndnboost/random/detail/seed_impl.hpp b/include/ndnboost/random/detail/seed_impl.hpp
new file mode 100644
index 0000000..7184edc
--- /dev/null
+++ b/include/ndnboost/random/detail/seed_impl.hpp
@@ -0,0 +1,397 @@
+/* boost random/detail/seed.hpp header file
+ *
+ * Copyright Steven Watanabe 2009
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org for most recent version including documentation.
+ *
+ * $Id: seed_impl.hpp 72951 2011-07-07 04:57:37Z steven_watanabe $
+ */
+
+#ifndef NDNBOOST_RANDOM_DETAIL_SEED_IMPL_HPP
+#define NDNBOOST_RANDOM_DETAIL_SEED_IMPL_HPP
+
+#include <stdexcept>
+#include <ndnboost/cstdint.hpp>
+#include <ndnboost/config/no_tr1/cmath.hpp>
+#include <ndnboost/integer/integer_mask.hpp>
+#include <ndnboost/integer/static_log2.hpp>
+#include <ndnboost/type_traits/is_signed.hpp>
+#include <ndnboost/type_traits/is_integral.hpp>
+#include <ndnboost/type_traits/make_unsigned.hpp>
+#include <ndnboost/mpl/bool.hpp>
+#include <ndnboost/mpl/if.hpp>
+#include <ndnboost/mpl/int.hpp>
+#include <ndnboost/random/detail/const_mod.hpp>
+#include <ndnboost/random/detail/integer_log2.hpp>
+#include <ndnboost/random/detail/signed_unsigned_tools.hpp>
+#include <ndnboost/random/detail/generator_bits.hpp>
+
+#include <ndnboost/random/detail/disable_warnings.hpp>
+
+namespace ndnboost {
+namespace random {
+namespace detail {
+
+// finds the seed type of an engine, given its
+// result_type.  If the result_type is integral
+// the seed type is the same.  If the result_type
+// is floating point, the seed type is uint32_t
+template<class T>
+struct seed_type
+{
+    typedef typename ndnboost::mpl::if_<ndnboost::is_integral<T>,
+        T,
+        ndnboost::uint32_t
+    >::type type;
+};
+
+template<int N>
+struct const_pow_impl
+{
+    template<class T>
+    static T call(T arg, int n, T result)
+    {
+        return const_pow_impl<N / 2>::call(arg * arg, n / 2,
+            n%2 == 0? result : result * arg);
+    }
+};
+
+template<>
+struct const_pow_impl<0>
+{
+    template<class T>
+    static T call(T, int, T result)
+    {
+        return result;
+    }
+};
+
+// requires N is an upper bound on n
+template<int N, class T>
+inline T const_pow(T arg, int n) { return const_pow_impl<N>::call(arg, n, T(1)); }
+
+template<class T>
+inline T pow2(int n)
+{
+    typedef unsigned int_type;
+    const int max_bits = std::numeric_limits<int_type>::digits;
+    T multiplier = T(int_type(1) << (max_bits - 1)) * 2;
+    return (int_type(1) << (n % max_bits)) *
+        const_pow<std::numeric_limits<T>::digits / max_bits>(multiplier, n / max_bits);
+}
+
+template<class Engine, class Iter>
+void generate_from_real(Engine& eng, Iter begin, Iter end)
+{
+    using std::fmod;
+    typedef typename Engine::result_type RealType;
+    const int Bits = detail::generator_bits<Engine>::value();
+    int remaining_bits = 0;
+    ndnboost::uint_least32_t saved_bits = 0;
+    RealType multiplier = pow2<RealType>( Bits);
+    RealType mult32 = RealType(4294967296.0); // 2^32
+    while(true) {
+        RealType val = eng() * multiplier;
+        int available_bits = Bits;
+        // Make sure the compiler can optimize this out
+        // if it isn't possible.
+        if(Bits < 32 && available_bits < 32 - remaining_bits) {
+            saved_bits |= ndnboost::uint_least32_t(val) << remaining_bits;
+            remaining_bits += Bits;
+        } else {
+            // If Bits < 32, then remaining_bits != 0, since
+            // if remaining_bits == 0, available_bits < 32 - 0,
+            // and we won't get here to begin with.
+            if(Bits < 32 || remaining_bits != 0) {
+                ndnboost::uint_least32_t divisor =
+                    (ndnboost::uint_least32_t(1) << (32 - remaining_bits));
+                ndnboost::uint_least32_t extra_bits = ndnboost::uint_least32_t(fmod(val, mult32)) & (divisor - 1);
+                val = val / divisor;
+                *begin++ = saved_bits | (extra_bits << remaining_bits);
+                if(begin == end) return;
+                available_bits -= 32 - remaining_bits;
+                remaining_bits = 0;
+            }
+            // If Bits < 32 we should never enter this loop
+            if(Bits >= 32) {
+                for(; available_bits >= 32; available_bits -= 32) {
+                    ndnboost::uint_least32_t word = ndnboost::uint_least32_t(fmod(val, mult32));
+                    val /= mult32;
+                    *begin++ = word;
+                    if(begin == end) return;
+                }
+            }
+            remaining_bits = available_bits;
+            saved_bits = static_cast<ndnboost::uint_least32_t>(val);
+        }
+    }
+}
+
+template<class Engine, class Iter>
+void generate_from_int(Engine& eng, Iter begin, Iter end)
+{
+    typedef typename Engine::result_type IntType;
+    typedef typename ndnboost::make_unsigned<IntType>::type unsigned_type;
+    int remaining_bits = 0;
+    ndnboost::uint_least32_t saved_bits = 0;
+    unsigned_type range = ndnboost::random::detail::subtract<IntType>()((eng.max)(), (eng.min)());
+
+    int bits =
+        (range == (std::numeric_limits<unsigned_type>::max)()) ?
+            std::numeric_limits<unsigned_type>::digits :
+            detail::integer_log2(range + 1);
+
+    {
+        int discarded_bits = detail::integer_log2(bits);
+        unsigned_type excess = (range + 1) >> (bits - discarded_bits);
+        if(excess != 0) {
+            int extra_bits = detail::integer_log2((excess - 1) ^ excess);
+            bits = bits - discarded_bits + extra_bits;
+        }
+    }
+
+    unsigned_type mask = (static_cast<unsigned_type>(2) << (bits - 1)) - 1;
+    unsigned_type limit = ((range + 1) & ~mask) - 1;
+
+    while(true) {
+        unsigned_type val;
+        do {
+            val = ndnboost::random::detail::subtract<IntType>()(eng(), (eng.min)());
+        } while(limit != range && val > limit);
+        val &= mask;
+        int available_bits = bits;
+        if(available_bits == 32) {
+            *begin++ = static_cast<ndnboost::uint_least32_t>(val) & 0xFFFFFFFFu;
+            if(begin == end) return;
+        } else if(available_bits % 32 == 0) {
+            for(int i = 0; i < available_bits / 32; ++i) {
+                ndnboost::uint_least32_t word = ndnboost::uint_least32_t(val) & 0xFFFFFFFFu;
+                int supress_warning = (bits >= 32);
+                NDNBOOST_ASSERT(supress_warning == 1);
+                val >>= (32 * supress_warning);
+                *begin++ = word;
+                if(begin == end) return;
+            }
+        } else if(bits < 32 && available_bits < 32 - remaining_bits) {
+            saved_bits |= ndnboost::uint_least32_t(val) << remaining_bits;
+            remaining_bits += bits;
+        } else {
+            if(bits < 32 || remaining_bits != 0) {
+                ndnboost::uint_least32_t extra_bits = ndnboost::uint_least32_t(val) & ((ndnboost::uint_least32_t(1) << (32 - remaining_bits)) - 1);
+                val >>= 32 - remaining_bits;
+                *begin++ = saved_bits | (extra_bits << remaining_bits);
+                if(begin == end) return;
+                available_bits -= 32 - remaining_bits;
+                remaining_bits = 0;
+            }
+            if(bits >= 32) {
+                for(; available_bits >= 32; available_bits -= 32) {
+                    ndnboost::uint_least32_t word = ndnboost::uint_least32_t(val) & 0xFFFFFFFFu;
+                    int supress_warning = (bits >= 32);
+                    NDNBOOST_ASSERT(supress_warning == 1);
+                    val >>= (32 * supress_warning);
+                    *begin++ = word;
+                    if(begin == end) return;
+                }
+            }
+            remaining_bits = available_bits;
+            saved_bits = static_cast<ndnboost::uint_least32_t>(val);
+        }
+    }
+}
+
+template<class Engine, class Iter>
+void generate_impl(Engine& eng, Iter first, Iter last, ndnboost::mpl::true_)
+{
+    return detail::generate_from_int(eng, first, last);
+}
+
+template<class Engine, class Iter>
+void generate_impl(Engine& eng, Iter first, Iter last, ndnboost::mpl::false_)
+{
+    return detail::generate_from_real(eng, first, last);
+}
+
+template<class Engine, class Iter>
+void generate(Engine& eng, Iter first, Iter last)
+{
+    return detail::generate_impl(eng, first, last, ndnboost::is_integral<typename Engine::result_type>());
+}
+
+
+
+template<class IntType, IntType m, class SeedSeq>
+IntType seed_one_int(SeedSeq& seq)
+{
+    static const int log = ::ndnboost::mpl::if_c<(m == 0),
+        ::ndnboost::mpl::int_<(::std::numeric_limits<IntType>::digits)>,
+        ::ndnboost::static_log2<m> >::type::value;
+    static const int k =
+        (log + ((~(static_cast<IntType>(2) << (log - 1)) & m)? 32 : 31)) / 32;
+    ::ndnboost::uint_least32_t array[log / 32 + 4];
+    seq.generate(&array[0], &array[0] + k + 3);
+    IntType s = 0;
+    for(int j = 0; j < k; ++j) {
+        IntType digit = const_mod<IntType, m>::apply(IntType(array[j+3]));
+        IntType mult = IntType(1) << 32*j;
+        s = const_mod<IntType, m>::mult_add(mult, digit, s);
+    }
+    return s;
+}
+
+template<class IntType, IntType m, class Iter>
+IntType get_one_int(Iter& first, Iter last)
+{
+    static const int log = ::ndnboost::mpl::if_c<(m == 0),
+        ::ndnboost::mpl::int_<(::std::numeric_limits<IntType>::digits)>,
+        ::ndnboost::static_log2<m> >::type::value;
+    static const int k =
+        (log + ((~(static_cast<IntType>(2) << (log - 1)) & m)? 32 : 31)) / 32;
+    IntType s = 0;
+    for(int j = 0; j < k; ++j) {
+        if(first == last) {
+            throw ::std::invalid_argument("Not enough elements in call to seed.");
+        }
+        IntType digit = const_mod<IntType, m>::apply(IntType(*first++));
+        IntType mult = IntType(1) << 32*j;
+        s = const_mod<IntType, m>::mult_add(mult, digit, s);
+    }
+    return s;
+}
+
+// TODO: work in-place whenever possible
+template<int w, std::size_t n, class SeedSeq, class UIntType>
+void seed_array_int_impl(SeedSeq& seq, UIntType (&x)[n])
+{
+    ndnboost::uint_least32_t storage[((w+31)/32) * n];
+    seq.generate(&storage[0], &storage[0] + ((w+31)/32) * n);
+    for(std::size_t j = 0; j < n; j++) {
+        UIntType val = 0;
+        for(std::size_t k = 0; k < (w+31)/32; ++k) {
+            val += static_cast<UIntType>(storage[(w+31)/32*j + k]) << 32*k;
+        }
+        x[j] = val & ::ndnboost::low_bits_mask_t<w>::sig_bits;
+    }
+}
+
+template<int w, std::size_t n, class SeedSeq, class IntType>
+inline void seed_array_int_impl(SeedSeq& seq, IntType (&x)[n], ndnboost::mpl::true_)
+{
+    typedef typename ndnboost::make_unsigned<IntType>::type unsigned_array[n];
+    seed_array_int_impl<w>(seq, reinterpret_cast<unsigned_array&>(x));
+}
+
+template<int w, std::size_t n, class SeedSeq, class IntType>
+inline void seed_array_int_impl(SeedSeq& seq, IntType (&x)[n], ndnboost::mpl::false_)
+{
+    seed_array_int_impl<w>(seq, x);
+}
+
+template<int w, std::size_t n, class SeedSeq, class IntType>
+inline void seed_array_int(SeedSeq& seq, IntType (&x)[n])
+{
+    seed_array_int_impl<w>(seq, x, ndnboost::is_signed<IntType>());
+}
+
+template<int w, std::size_t n, class Iter, class UIntType>
+void fill_array_int_impl(Iter& first, Iter last, UIntType (&x)[n])
+{
+    for(std::size_t j = 0; j < n; j++) {
+        UIntType val = 0;
+        for(std::size_t k = 0; k < (w+31)/32; ++k) {
+            if(first == last) {
+                throw std::invalid_argument("Not enough elements in call to seed.");
+            }
+            val += static_cast<UIntType>(*first++) << 32*k;
+        }
+        x[j] = val & ::ndnboost::low_bits_mask_t<w>::sig_bits;
+    }
+}
+
+template<int w, std::size_t n, class Iter, class IntType>
+inline void fill_array_int_impl(Iter& first, Iter last, IntType (&x)[n], ndnboost::mpl::true_)
+{
+    typedef typename ndnboost::make_unsigned<IntType>::type unsigned_array[n];
+    fill_array_int_impl<w>(first, last, reinterpret_cast<unsigned_array&>(x));
+}
+
+template<int w, std::size_t n, class Iter, class IntType>
+inline void fill_array_int_impl(Iter& first, Iter last, IntType (&x)[n], ndnboost::mpl::false_)
+{
+    fill_array_int_impl<w>(first, last, x);
+}
+
+template<int w, std::size_t n, class Iter, class IntType>
+inline void fill_array_int(Iter& first, Iter last, IntType (&x)[n])
+{
+    fill_array_int_impl<w>(first, last, x, ndnboost::is_signed<IntType>());
+}
+
+template<int w, std::size_t n, class RealType>
+void seed_array_real_impl(const ndnboost::uint_least32_t* storage, RealType (&x)[n])
+{
+    ndnboost::uint_least32_t mask = ~((~ndnboost::uint_least32_t(0)) << (w%32));
+    RealType two32 = 4294967296.0;
+    const RealType divisor = RealType(1)/detail::pow2<RealType>(w);
+    unsigned int j;
+    for(j = 0; j < n; ++j) {
+        RealType val = RealType(0);
+        RealType mult = divisor;
+        for(int k = 0; k < w/32; ++k) {
+            val += *storage++ * mult;
+            mult *= two32;
+        }
+        if(mask != 0) {
+            val += (*storage++ & mask) * mult;
+        }
+        NDNBOOST_ASSERT(val >= 0);
+        NDNBOOST_ASSERT(val < 1);
+        x[j] = val;
+    }
+}
+
+template<int w, std::size_t n, class SeedSeq, class RealType>
+void seed_array_real(SeedSeq& seq, RealType (&x)[n])
+{
+    using std::pow;
+    ndnboost::uint_least32_t storage[((w+31)/32) * n];
+    seq.generate(&storage[0], &storage[0] + ((w+31)/32) * n);
+    seed_array_real_impl<w>(storage, x);
+}
+
+template<int w, std::size_t n, class Iter, class RealType>
+void fill_array_real(Iter& first, Iter last, RealType (&x)[n])
+{
+    ndnboost::uint_least32_t mask = ~((~ndnboost::uint_least32_t(0)) << (w%32));
+    RealType two32 = 4294967296.0;
+    const RealType divisor = RealType(1)/detail::pow2<RealType>(w);
+    unsigned int j;
+    for(j = 0; j < n; ++j) {
+        RealType val = RealType(0);
+        RealType mult = divisor;
+        for(int k = 0; k < w/32; ++k, ++first) {
+            if(first == last) throw std::invalid_argument("Not enough elements in call to seed.");
+            val += *first * mult;
+            mult *= two32;
+        }
+        if(mask != 0) {
+            if(first == last) throw std::invalid_argument("Not enough elements in call to seed.");
+            val += (*first & mask) * mult;
+            ++first;
+        }
+        NDNBOOST_ASSERT(val >= 0);
+        NDNBOOST_ASSERT(val < 1);
+        x[j] = val;
+    }
+}
+
+}
+}
+}
+
+#include <ndnboost/random/detail/enable_warnings.hpp>
+
+#endif
diff --git a/include/ndnboost/random/detail/signed_unsigned_tools.hpp b/include/ndnboost/random/detail/signed_unsigned_tools.hpp
new file mode 100644
index 0000000..8fcb1b6
--- /dev/null
+++ b/include/ndnboost/random/detail/signed_unsigned_tools.hpp
@@ -0,0 +1,89 @@
+/* boost random/detail/signed_unsigned_tools.hpp header file
+ *
+ * Copyright Jens Maurer 2006
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org for most recent version including documentation.
+ */
+
+#ifndef NDNBOOST_RANDOM_DETAIL_SIGNED_UNSIGNED_TOOLS
+#define NDNBOOST_RANDOM_DETAIL_SIGNED_UNSIGNED_TOOLS
+
+#include <ndnboost/limits.hpp>
+#include <ndnboost/config.hpp>
+#include <ndnboost/type_traits/make_unsigned.hpp>
+
+namespace ndnboost {
+namespace random {
+namespace detail {
+
+
+/*
+ * Compute x - y, we know that x >= y, return an unsigned value.
+ */
+
+template<class T, bool sgn = std::numeric_limits<T>::is_signed>
+struct subtract { };
+
+template<class T>
+struct subtract<T, /* signed */ false>
+{
+  typedef T result_type;
+  result_type operator()(T x, T y) { return x - y; }
+};
+
+template<class T>
+struct subtract<T, /* signed */ true>
+{
+  typedef typename make_unsigned<T>::type result_type;
+  result_type operator()(T x, T y)
+  {
+    if (y >= 0)   // because x >= y, it follows that x >= 0, too
+      return result_type(x) - result_type(y);
+    if (x >= 0)   // y < 0
+      // avoid the nasty two's complement case for y == min()
+      return result_type(x) + result_type(-(y+1)) + 1;
+    // both x and y are negative: no signed overflow
+    return result_type(x - y);
+  }
+};
+
+/*
+ * Compute x + y, x is unsigned, result fits in type of "y".
+ */
+
+template<class T1, class T2, bool sgn = std::numeric_limits<T2>::is_signed>
+struct add { };
+
+template<class T1, class T2>
+struct add<T1, T2, /* signed */ false>
+{
+  typedef T2 result_type;
+  result_type operator()(T1 x, T2 y) { return T2(x) + y; }
+};
+
+template<class T1, class T2>
+struct add<T1, T2, /* signed */ true>
+{
+  typedef T2 result_type;
+  result_type operator()(T1 x, T2 y)
+  {
+    if (y >= 0)
+      return T2(x) + y;
+    // y < 0
+    if (x > T1(-(y+1)))  // result >= 0 after subtraction
+      // avoid the nasty two's complement edge case for y == min()
+      return T2(x - T1(-(y+1)) - 1);
+    // abs(x) < abs(y), thus T2 able to represent x
+    return T2(x) + y;
+  }
+};
+
+} // namespace detail
+} // namespace random
+} // namespace ndnboost
+
+#endif // NDNBOOST_RANDOM_DETAIL_SIGNED_UNSIGNED_TOOLS
+
